Class: LiveEvents::GradeEvent

Inherits:
BaseEvent show all
Defined in:
lib/canvas_sync/generators/templates/services/live_events/grade/grade_event.rb

Direct Known Subclasses

GradeChangedEvent

Instance Attribute Summary

Attributes inherited from BaseEvent

#payload

Instance Method Summary collapse

Methods inherited from BaseEvent

#local_canvas_id

Methods inherited from CanvasSync::Job

#create_job_log, #report_checker_wait_time

Instance Method Details

#perform(event_payload) ⇒ Object

The following is provided in the live events call:

submission_id: submission.global_id,
assignment_id: submission.global_assignment_id,
grade: submission.grade,
old_grade: old_submission.try(:grade),
score: submission.score,
old_score: old_submission.try(:score),
points_possible: submission.assignment.points_possible,
old_points_possible: old_assignment.points_possible,
grader_id: grader_id,
student_id: submission.global_user_id,
user_id: submission.global_user_id,
grading_complete: submission.graded?,
muted: submission.muted_assignment?



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/canvas_sync/generators/templates/services/live_events/grade/grade_event.rb', line 22

def perform(event_payload)
  super
  attrs = {
    submission_id: submission.try(:id),
    assignment_id: assignment.try(:id),
    score: payload[:score],
    points_possible: payload[:points_possible],
    grader_id: payload[:grader_id],
    user_id: user.try(:id),
    grading_complete: payload[:grading_complete],
    muted: payload[:muted],
  }
  create_or_update(attrs)
end