Skip to content

Commit

Permalink
add assignment_name to grade_change event
Browse files Browse the repository at this point in the history
closes PLAT-4968

test plan:
* give a student a grade for an assignment
* configure the live events plugin using `doc/live_events.md`
* tail the kinesis stream following the directions in `doc/live_events.md`
* change the grade for the student
* assert that the assigment_name is present in the event body

Change-Id: Ibcabdada2a1c4ba7cd9b29bc6bacdbb387ec41f1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/215983
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Tested-by: Jenkins
  • Loading branch information
xandroxygen committed Nov 5, 2019
1 parent 970fc65 commit 188085c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/api/live_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ these cases, `grader_id` should be null in the body.
| ----- | ----------- |
| `submission_id` | The Canvas id of the submission that the grade is changing on. |
| `assignment_id` | The Canvas id of the assignment associated with the submission. |
| `assignment_name` | The name of the assignment associated with the submission. |
| `grade` | The new grade. |
| `old_grade` | The previous grade, if there was one. |
| `score` | The new score. |
Expand Down
1 change: 1 addition & 0 deletions lib/canvas/live_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ def self.grade_changed(submission, old_submission=nil, old_assignment=submission
post_event_stringified('grade_change', {
submission_id: submission.global_id,
assignment_id: submission.global_assignment_id,
assignment_name: submission.assignment.name,
grade: submission.grade,
old_grade: old_submission.try(:grade),
score: submission.score,
Expand Down
3 changes: 3 additions & 0 deletions spec/lib/canvas/live_events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ def wiki_page_updated
expect_event('grade_change', hash_including({
submission_id: @quiz_submission.submission.global_id.to_s,
assignment_id: @quiz_submission.submission.global_assignment_id.to_s,
assignment_name: @quiz_submission.submission.assignment.name,
grader_id: nil,
student_id: @quiz_submission.user.global_id.to_s,
user_id: @quiz_submission.user.global_id.to_s
Expand All @@ -271,6 +272,7 @@ def wiki_page_updated
expect_event('grade_change', hash_including(
submission_id: submission.global_id.to_s,
assignment_id: submission.global_assignment_id.to_s,
assignment_name: submission.assignment.name,
grader_id: @teacher.global_id.to_s,
student_id: @student.global_id.to_s,
user_id: @student.global_id.to_s
Expand All @@ -289,6 +291,7 @@ def wiki_page_updated
expect_event('grade_change',
hash_including({
assignment_id: submission.global_assignment_id.to_s,
assignment_name: submission.assignment.name,
user_id: @student.global_id.to_s,
student_id: @student.global_id.to_s,
student_sis_id: nil
Expand Down

0 comments on commit 188085c

Please sign in to comment.