Sha256: e2a0aaf04a09d09a6daa922d606a7adacfb6897c3f88af714fea82a15478e65c
Contents?: true
Size: 1.54 KB
Versions: 19
Compression:
Stored size: 1.54 KB
Contents
<%= autogenerated_event_warning %> class LiveEvents::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) rescue => e log_error e ensure true 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
Version data entries
19 entries across 19 versions & 1 rubygems