Skip to content

Commit

Permalink
Add support for the canvas override grade column
Browse files Browse the repository at this point in the history
  • Loading branch information
joelostblom committed Jul 8, 2021
1 parent 76245ef commit c553b79
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
Version number is based on [Semver](https://semver.org/).
Note that major version zero (0.y.z) is for initial development and anything may change at any time.

## [0.3.2] - 2021-07-07

### Added
- Support for the Canvas override final grade column.

## [0.3.1] - 2021-06-01

### Added
Expand Down
14 changes: 13 additions & 1 deletion canvascli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,25 @@ def get_canvas_grades(self):
enrollments = self.course.get_enrollments(
type=['StudentEnrollment'], state=[self.student_status])
canvas_grades = defaultdict(list)
overridden_grades = []
for enrollment in enrollments:
canvas_grades['Student Number'].append(enrollment.user['sis_user_id'])
surname, preferred_name = enrollment.user['sortable_name'].split(', ')
canvas_grades['Surname'].append(surname)
canvas_grades['Preferred Name'].append(preferred_name)
canvas_grades['Percent Grade'].append(enrollment.grades['final_score'])
if 'override_score' in enrollment.grades:
overridden_grades.append(
f"{preferred_name:<12} {surname:<12}"
f" {enrollment.grades['final_score']:<4} ->"
f" {enrollment.grades['override_score']}")
canvas_grades['Percent Grade'].append(enrollment.grades['override_score'])
else:
canvas_grades['Percent Grade'].append(enrollment.grades['final_score'])
self.canvas_grades = pd.DataFrame(canvas_grades)
if len(overridden_grades) > 0:
click.echo('Students with manual Canvas override of their final grade:')
[click.echo(grade) for grade in overridden_grades]
click.echo()
return

def drop_student_entries(self):
Expand Down

0 comments on commit c553b79

Please sign in to comment.