nbgrader
This module process the nbgrader generated csv grades files and the output directories, and use canvas api to post grade to students, with late penalty and the messages.
nbgrader_grade
nbgrader_grade (credentials_fp='', late_exception_fp='', API_URL='https://canvas.ucsd.edu', course_id='', assignment_id=-1, grades_fp='', verbosity=0)
Initialize Canvas Group within a Group Set and its appropriate memberships
Type | Default | Details | |
---|---|---|---|
credentials_fp | str | credential file path. Template of the credentials.json | |
late_exception_fp | str | late exception yaml file path. Template of the late_exception.yaml | |
API_URL | str | https://canvas.ucsd.edu | the domain name of canvas |
course_id | str | Course ID, can be found in the course url | |
assignment_id | int | -1 | assignment id, can be found in the canvas assignment url |
grades_fp | str | nbgrader csv grades exports file path | |
verbosity | int | 0 | Controls the verbosity: 0 = Silent, 1 = print all messages |
nbgrader_grade.auth_canvas
nbgrader_grade.auth_canvas (credentials_fp:str)
Authorize the canvas module with API_KEY
Type | Details | |
---|---|---|
credentials_fp | str | the Authenticator key generated from canvas |
nbgrader_grade.set_course
nbgrader_grade.set_course (course_id:int)
Set the target course by the course ID
Type | Details | |
---|---|---|
course_id | int | the course id of the target course |
nbgrader_grade.link_assignment
nbgrader_grade.link_assignment (assignment_id:int)
Link the target assignment on canvas
Type | Details | |
---|---|---|
assignment_id | int | assignment id, found at the url of assignmnet tab |
Returns | Assignment | target assignment |
nbgrader_grade.load_grades_csv
nbgrader_grade.load_grades_csv (csv_pf:str)
Load nbgrader exported csv file
Type | Details | |
---|---|---|
csv_pf | str | csv file path |
nbgrader_grade.load_late_exception
nbgrader_grade.load_late_exception (yaml_fp:str)
Load Late Exception File
Type | Details | |
---|---|---|
yaml_fp | str | yaml file path stores exception student cases |
nbgrader_grade.get_late_days
nbgrader_grade.get_late_days (target_assignment:str, student_id:str)
Calculate the late day of students submission of the target assignment
Type | Details | |
---|---|---|
target_assignment | str | target assignment name. Must in the column of nbgrader assignment csv |
student_id | str | student id |
Returns | int | late days of the target assignment |
nbgrader_grade.calculate_credit_balance
nbgrader_grade.calculate_credit_balance (passed_assignments:List[str], student_id:str, default_credit=5)
Calculate the balance of late hours from the nbgrader file
Type | Default | Details | |
---|---|---|---|
passed_assignments | List | list of passed assignments name. Must in the column of assignment . |
|
student_id | str | target student | |
default_credit | int | 5 | default total number of allowed late days |
Returns | int | late credit balance of the target student |
nbgrader_grade._post_grade
nbgrader_grade._post_grade (student_id:int, grade:float, text_comment='')
Post grade and comment to canvas to the target assignment
Type | Default | Details | |
---|---|---|---|
student_id | int | canvas student id of student. found in self.email_to_canvas_id | |
grade | float | grade of that assignment | |
text_comment | str | text comment of the submission, student will see it on the grade feedback | |
Returns | Submission | created submission |
nbgrader_grade.post_to_canvas
nbgrader_grade.post_to_canvas (target_assignment:str, passed_assignments:List[str], default_credit:int=7, late_submission_deadline:int=5, post=True)
Post grade to canvas with late penalty.
Type | Default | Details | |
---|---|---|---|
target_assignment | str | target assignment name to grab the late time. Must in the column of nbgrader assignment csv | |
passed_assignments | List | list of passed assignment. Must in the column of nbgrader assignment csv | |
default_credit | int | 7 | default amount of late days calculated, used in FA24 COGS108 |
late_submission_deadline | int | 5 | the maximum amount of late days that we allow. Implements: We don’t accept late submission after 5 days. |
post | bool | True | for testing purposes. Can halt the post operation |