Sha256: 1a71fa7abb24921902d78bc2f11d21c7d54ab5f99e3910a668c5f9846f1682b6
Contents?: true
Size: 1.59 KB
Versions: 27
Compression:
Stored size: 1.59 KB
Contents
# <%= autogenerated_event_warning %> module LiveEvents class GradeEvent < LiveEvents::BaseEvent # 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? # } 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 private def create_or_update(attrs) # TODO: add your code here end def submission Submission.find_by(canvas_submission_id: local_canvas_id(payload[:submission_id])) end def assignment Assignment.find_by(canvas_assignment_id: local_canvas_id(payload[:assignment_id])) end def user User.find_by(canvas_user_id: local_canvas_id(payload[:user_id])) end end end
Version data entries
27 entries across 27 versions & 1 rubygems