canvas_sync 0.3.23 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -0
  3. data/lib/canvas_sync.rb +11 -1
  4. data/lib/canvas_sync/generators/templates/services/live_events/assignment/assignment_created_event.rb +5 -4
  5. data/lib/canvas_sync/generators/templates/services/live_events/assignment/assignment_event.rb +40 -49
  6. data/lib/canvas_sync/generators/templates/services/live_events/assignment/assignment_updated_event.rb +5 -3
  7. data/lib/canvas_sync/generators/templates/services/live_events/base_event.rb +12 -19
  8. data/lib/canvas_sync/generators/templates/services/live_events/course/course_created_event.rb +5 -3
  9. data/lib/canvas_sync/generators/templates/services/live_events/course/course_event.rb +32 -38
  10. data/lib/canvas_sync/generators/templates/services/live_events/course/course_updated_event.rb +5 -3
  11. data/lib/canvas_sync/generators/templates/services/live_events/enrollment/enrollment_created_event.rb +5 -3
  12. data/lib/canvas_sync/generators/templates/services/live_events/enrollment/enrollment_event.rb +53 -56
  13. data/lib/canvas_sync/generators/templates/services/live_events/enrollment/enrollment_updated_event.rb +5 -3
  14. data/lib/canvas_sync/generators/templates/services/live_events/grade/grade_changed_event.rb +5 -3
  15. data/lib/canvas_sync/generators/templates/services/live_events/grade/grade_event.rb +47 -48
  16. data/lib/canvas_sync/generators/templates/services/live_events/module/module_created_event.rb +6 -0
  17. data/lib/canvas_sync/generators/templates/services/live_events/module/module_event.rb +39 -0
  18. data/lib/canvas_sync/generators/templates/services/live_events/module/module_updated_event.rb +6 -0
  19. data/lib/canvas_sync/generators/templates/services/live_events/submission/submission_created_event.rb +5 -3
  20. data/lib/canvas_sync/generators/templates/services/live_events/submission/submission_event.rb +40 -45
  21. data/lib/canvas_sync/generators/templates/services/live_events/submission/submission_updated_event.rb +5 -3
  22. data/lib/canvas_sync/generators/templates/services/live_events/syllabus/syllabus_event.rb +29 -30
  23. data/lib/canvas_sync/generators/templates/services/live_events/syllabus/syllabus_updated_event.rb +4 -2
  24. data/lib/canvas_sync/generators/templates/services/live_events/user/user_created_event.rb +5 -3
  25. data/lib/canvas_sync/generators/templates/services/live_events/user/user_event.rb +5 -8
  26. data/lib/canvas_sync/generators/templates/services/live_events/user/user_updated_event.rb +5 -3
  27. data/lib/canvas_sync/version.rb +1 -1
  28. data/spec/canvas_sync/services/module_event_spec.rb +42 -0
  29. data/spec/dummy/app/services/live_events/assignment_created_event.rb +12 -0
  30. data/spec/dummy/app/services/live_events/assignment_event.rb +60 -0
  31. data/spec/dummy/app/services/live_events/assignment_updated_event.rb +12 -0
  32. data/spec/dummy/app/services/live_events/base_event.rb +22 -0
  33. data/spec/dummy/app/services/live_events/course_created_event.rb +12 -0
  34. data/spec/dummy/app/services/live_events/course_event.rb +42 -0
  35. data/spec/dummy/app/services/live_events/course_updated_event.rb +12 -0
  36. data/spec/dummy/app/services/live_events/enrollment_created_event.rb +12 -0
  37. data/spec/dummy/app/services/live_events/enrollment_event.rb +61 -0
  38. data/spec/dummy/app/services/live_events/enrollment_updated_event.rb +12 -0
  39. data/spec/dummy/app/services/live_events/grade_changed_event.rb +12 -0
  40. data/spec/dummy/app/services/live_events/grade_event.rb +61 -0
  41. data/spec/dummy/app/services/live_events/module_created_event.rb +12 -0
  42. data/spec/dummy/app/services/live_events/module_event.rb +45 -0
  43. data/spec/dummy/app/services/live_events/module_updated_event.rb +12 -0
  44. data/spec/dummy/app/services/live_events/submission_created_event.rb +12 -0
  45. data/spec/dummy/app/services/live_events/submission_event.rb +58 -0
  46. data/spec/dummy/app/services/live_events/submission_updated_event.rb +12 -0
  47. data/spec/dummy/app/services/live_events/syllabus_event.rb +40 -0
  48. data/spec/dummy/app/services/live_events/syllabus_updated_event.rb +12 -0
  49. data/spec/dummy/app/services/live_events/user_created_event.rb +12 -0
  50. data/spec/dummy/app/services/live_events/user_event.rb +38 -0
  51. data/spec/dummy/app/services/live_events/user_updated_event.rb +12 -0
  52. data/spec/dummy/log/development.log +666 -0
  53. data/spec/dummy/log/test.log +3758 -0
  54. data/spec/support/fake_canvas.rb +4 -0
  55. data/spec/support/fixtures/canvas_responses/module.json +12 -0
  56. metadata +57 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ccdb328d97ea616a2a39b64ba9850567fefb03ae271306645fe878f82dbdf77d
4
- data.tar.gz: dca87f606c8c5f4cede335ea725e8b18240592a2464a54295bc96c1812aaf373
3
+ metadata.gz: 9134dcc286332c0330b16783033e524f75b69f7039455d2e0aab562a50709181
4
+ data.tar.gz: 6575d7cb108b9977015db6f0e55c9de6fc3d7e0c8753e18889b381384d87b6e3
5
5
  SHA512:
6
- metadata.gz: 2ccfc2afaa8a06b8ba6dde376c12354910ecd9116341168d900b13ad67218d7480fd74485ea11dcf7d2d1c8478c65cb78d28090f7025024a485e5a1682b1a994
7
- data.tar.gz: 402f8066f80bbd3c0858492ffc6afb91f32b1006d7d46c89368a589b50ed8c720eaaa617a18323fec3fe582b7deec3ef4edb4760c0658123048e781b44236faf
6
+ metadata.gz: d21d1deaec48dc3eb4c008eacdf0336373a4aa3a0e0bf4d9e68050b65b7529be883756408b97999aa13a78d6c1c158412beaf3413fef87ece53a1623651be91b
7
+ data.tar.gz: f8e73459889128a11793ecb0d9edf423edc3504c071eec4ed8728b79764f803395aa71a9a348108e38604eab1aedeba815cd023f75cfaa740686c22a5adec181
data/Rakefile CHANGED
@@ -10,6 +10,8 @@ desc 'This updates the models and migrations used by the testing Rails Dummy app
10
10
  task :update_test_schema do
11
11
  puts "Updating test models and migration files..."
12
12
  stream_command("spec/dummy/bin/rails generate canvas_sync:install --models all --force")
13
+ puts "Updating live event files..."
14
+ stream_command("spec/dummy/bin/rails generate canvas_sync:install_live_events --events all --force")
13
15
  puts "Updating the test database and schema..."
14
16
  stream_command("cd spec/dummy; bundle exec rake db:drop; bundle exec rake db:create; bundle exec rake db:migrate")
15
17
  end
@@ -36,7 +36,17 @@ module CanvasSync
36
36
  context_module_items
37
37
  xlist
38
38
  ].freeze
39
- SUPPORTED_LIVE_EVENTS = %w[course enrollment submission assignment user syllabus grade].freeze
39
+
40
+ SUPPORTED_LIVE_EVENTS = %w[
41
+ course
42
+ enrollment
43
+ submission
44
+ assignment
45
+ user
46
+ syllabus
47
+ grade
48
+ module
49
+ ].freeze
40
50
 
41
51
  # Runs a standard provisioning sync job with no extra report types.
42
52
  # Terms will be synced first using the API. If you are syncing users/roles/admins
@@ -1,5 +1,6 @@
1
- <%= autogenerated_event_warning %>
1
+ # <%= autogenerated_event_warning %>
2
2
 
3
- class LiveEvents::AssignmentCreatedEvent < LiveEvents::AssignmentEvent
4
-
5
- end
3
+ module LiveEvents
4
+ class AssignmentCreatedEvent < LiveEvents::AssignmentEvent
5
+ end
6
+ end
@@ -1,63 +1,54 @@
1
- <%= autogenerated_event_warning %>
1
+ # <%= autogenerated_event_warning %>
2
2
 
3
- class LiveEvents::AssignmentEvent < LiveEvents::BaseEvent
4
- # The following is provided in the live events call:
5
- # {
6
- # assignment_id: assignment.global_id,
7
- # context_id: assignment.global_context_id,
8
- # context_type: assignment.context_type,
9
- # workflow_state: assignment.workflow_state,
10
- # title: LiveEvents.truncate(assignment.title),
11
- # description: LiveEvents.truncate(assignment.description),
12
- # due_at: assignment.due_at,
13
- # unlock_at: assignment.unlock_at,
14
- # lock_at: assignment.lock_at,
15
- # updated_at: assignment.updated_at,
16
- # points_possible: assignment.points_possible
17
- # }
3
+ module LiveEvents
4
+ class AssignmentEvent < LiveEvents::BaseEvent
5
+ # The following is provided in the live events call:
6
+ # {
7
+ # assignment_id: assignment.global_id,
8
+ # context_id: assignment.global_context_id,
9
+ # context_type: assignment.context_type,
10
+ # workflow_state: assignment.workflow_state,
11
+ # title: LiveEvents.truncate(assignment.title),
12
+ # description: LiveEvents.truncate(assignment.description),
13
+ # due_at: assignment.due_at,
14
+ # unlock_at: assignment.unlock_at,
15
+ # lock_at: assignment.lock_at,
16
+ # updated_at: assignment.updated_at,
17
+ # points_possible: assignment.points_possible
18
+ # }
18
19
 
19
- def perform(event_payload)
20
- super
21
- attrs = {
20
+ def perform(event_payload)
21
+ super
22
+ attrs = {
22
23
  canvas_assignment_id: local_canvas_id(payload[:assignment_id]),
23
- course_id: course.try(:id),
24
- name: payload[:title],
24
+ title: payload[:title],
25
25
  workflow_state: payload[:workflow_state],
26
26
  description: payload[:description],
27
27
  due_at: payload[:due_at],
28
28
  unlock_at: payload[:unlock_at],
29
29
  lock_at: payload[:lock_at],
30
30
  points_possible: payload[:points_possible],
31
- canvas_updated_at: payload[:updated_at]
32
- }
33
- create_or_update(attrs)
34
- rescue => e
35
- log_error e
36
- ensure
37
- true
38
- end
31
+ }
32
+ create_or_update(attrs)
33
+ end
39
34
 
40
- private
41
- def create_or_update(attrs)
42
- assignment = Assignment.where(canvas_assignment_id: attrs[:canvas_assignment_id]).first_or_initialize
43
- assignment.assign_attributes(attrs)
44
- assignment.save!
45
- assignment
46
- end
35
+ private
47
36
 
48
- # This could be nil if the context type for this assignment is not 'Course' of if a local course was not found
49
- def canvas_course_id
50
- payload[:context_type] == 'Course' ? local_canvas_id(payload[:context_id]) : nil
51
- end
37
+ def create_or_update(attrs)
38
+ assignment = Assignment.where(canvas_assignment_id: attrs[:canvas_assignment_id]).first_or_initialize
39
+ assignment.assign_attributes(attrs)
40
+ assignment.save!
41
+ assignment
42
+ end
52
43
 
53
- # This could be nil if the context type for this assignment is not 'Course' of if a local course was not found
54
- def course
55
- unless @course
56
- if canvas_course_id.present?
57
- @course = Course.find_by(canvas_course_id: canvas_course_id)
58
- end
44
+ # This could be nil if the context type for this assignment is not 'Course' of if a local course was not found
45
+ def canvas_course_id
46
+ payload[:context_type] == "Course" ? local_canvas_id(payload[:context_id]) : nil
59
47
  end
60
- @course
61
- end
62
48
 
63
- end
49
+ # This could be nil if the context type for this assignment is not 'Course' of if a local course was not found
50
+ def course
51
+ @course ||= Course.find_by(canvas_course_id: canvas_course_id)
52
+ end
53
+ end
54
+ end
@@ -1,4 +1,6 @@
1
- <%= autogenerated_event_warning %>
1
+ # <%= autogenerated_event_warning %>
2
2
 
3
- class LiveEvents::AssignmentUpdatedEvent < LiveEvents::AssignmentEvent
4
- end
3
+ module LiveEvents
4
+ class AssignmentUpdatedEvent < LiveEvents::AssignmentEvent
5
+ end
6
+ end
@@ -1,23 +1,16 @@
1
- <%= autogenerated_event_warning %>
1
+ # <%= autogenerated_event_warning %>
2
2
 
3
- class LiveEvents::BaseEvent
3
+ module LiveEvents
4
+ class BaseEvent < CanvasSync::Job
5
+ attr_accessor :payload
4
6
 
5
- attr_accessor :payload
7
+ def perform(event_payload)
8
+ @payload = HashWithIndifferentAccess.new(event_payload["body"])
9
+ end
6
10
 
7
- def perform(event_payload)
8
- @payload = HashWithIndifferentAccess.new(event_payload['body'])
11
+ # Live events will use a canvas global ID (cross shard) for any ID's provided. This method will return the local ID.
12
+ def local_canvas_id(id)
13
+ id.to_i % 10_000_000_000_000
14
+ end
9
15
  end
10
-
11
- # Live events will use a canvas global ID (cross shard) for any ID's provided. This method will return the local ID.
12
- def local_canvas_id(id)
13
- id.to_i % 10_000_000_000_000
14
- end
15
-
16
- def log_error(e)
17
- Rails.logger.error "Error processing Live Event: #{self.class.name}"
18
- Rails.logger.error "#{payload}"
19
- Rails.logger.error e.message
20
- Rails.logger.error e.backtrace.join("\n")
21
- end
22
-
23
- end
16
+ end
@@ -1,4 +1,6 @@
1
- <%= autogenerated_event_warning %>
1
+ # <%= autogenerated_event_warning %>
2
2
 
3
- class LiveEvents::CourseCreatedEvent < LiveEvents::CourseEvent
4
- end
3
+ module LiveEvents
4
+ class CourseCreatedEvent < LiveEvents::CourseEvent
5
+ end
6
+ end
@@ -1,42 +1,36 @@
1
- <%= autogenerated_event_warning %>
2
-
3
- class LiveEvents::CourseEvent < LiveEvents::BaseEvent
4
-
5
- # The following is provided in the live events call:
6
- # {
7
- # course_id: course.global_id,
8
- # uuid: course.uuid,
9
- # account_id: course.global_account_id,
10
- # name: course.name,
11
- # created_at: course.created_at,
12
- # updated_at: course.updated_at,
13
- # workflow_state: course.workflow_state
14
- # }
15
-
16
-
17
- def perform(event_payload)
18
- super
19
- attrs = {
1
+ # <%= autogenerated_event_warning %>
2
+
3
+ module LiveEvents
4
+ class CourseEvent < LiveEvents::BaseEvent
5
+ # The following is provided in the live events call:
6
+ # {
7
+ # course_id: course.global_id,
8
+ # uuid: course.uuid,
9
+ # account_id: course.global_account_id,
10
+ # name: course.name,
11
+ # created_at: course.created_at,
12
+ # updated_at: course.updated_at,
13
+ # workflow_state: course.workflow_state
14
+ # }
15
+
16
+ def perform(event_payload)
17
+ super
18
+ attrs = {
20
19
  canvas_course_id: local_canvas_id(payload[:course_id]),
21
20
  canvas_account_id: local_canvas_id(payload[:account_id]),
22
- name: payload[:name],
23
- workflow_state: payload[:workflow_state]
24
- }
25
- create_or_update(attrs)
26
- rescue => e
27
- log_error e
28
- ensure
29
- true
21
+ long_name: payload[:name],
22
+ status: payload[:workflow_state],
23
+ }
24
+ create_or_update(attrs)
25
+ end
26
+
27
+ private
28
+
29
+ def create_or_update(attrs)
30
+ course = Course.where(canva_course_id: attrs[:canva_course_id]).first_or_initialize
31
+ course.assign_attributes(attrs)
32
+ course.save!
33
+ course
34
+ end
30
35
  end
31
-
32
- private
33
-
34
- def create_or_update(attrs)
35
- course = Course.where(canva_course_id: attrs[:canva_course_id]).first_or_initialize
36
- course.assign_attributes(attrs)
37
- course.save!
38
- course
39
- end
40
-
41
36
  end
42
-
@@ -1,4 +1,6 @@
1
- <%= autogenerated_event_warning %>
1
+ # <%= autogenerated_event_warning %>
2
2
 
3
- class LiveEvents::CourseUpdatedEvent < LiveEvents::CourseEvent
4
- end
3
+ module LiveEvents
4
+ class CourseUpdatedEvent < LiveEvents::CourseEvent
5
+ end
6
+ end
@@ -1,4 +1,6 @@
1
- <%= autogenerated_event_warning %>
1
+ # <%= autogenerated_event_warning %>
2
2
 
3
- class LiveEvents::EnrollmentCreatedEvent < LiveEvents::EnrollmentEvent
4
- end
3
+ module LiveEvents
4
+ class EnrollmentCreatedEvent < LiveEvents::EnrollmentEvent
5
+ end
6
+ end
@@ -1,58 +1,55 @@
1
- <%= autogenerated_event_warning %>
2
-
3
- class LiveEvents::EnrollmentEvent < LiveEvents::BaseEvent
4
-
5
- # The following is provided in the live events call:
6
- # {
7
- #
8
- # enrollment_id: enrollment.global_id,
9
- # course_id: enrollment.global_course_id,
10
- # user_id: enrollment.global_user_id,
11
- # user_name: enrollment.user_name,
12
- # type: enrollment.type,
13
- # created_at: enrollment.created_at,
14
- # updated_at: enrollment.updated_at,
15
- # limit_privileges_to_course_section: enrollment.limit_privileges_to_course_section,
16
- # course_section_id: enrollment.global_course_section_id,
17
- # workflow_state: enrollment.workflow_state
18
- # }
19
-
20
- def perform(paload)
21
- super
22
- return if course.nil? || section.nil? || user.nil?
23
- attrs = {
24
-
1
+ # <%= autogenerated_event_warning %>
2
+
3
+ module LiveEvents
4
+ class EnrollmentEvent < LiveEvents::BaseEvent
5
+ # The following is provided in the live events call:
6
+ # {
7
+ #
8
+ # enrollment_id: enrollment.global_id,
9
+ # course_id: enrollment.global_course_id,
10
+ # user_id: enrollment.global_user_id,
11
+ # user_name: enrollment.user_name,
12
+ # type: enrollment.type,
13
+ # created_at: enrollment.created_at,
14
+ # updated_at: enrollment.updated_at,
15
+ # limit_privileges_to_course_section: enrollment.limit_privileges_to_course_section,
16
+ # course_section_id: enrollment.global_course_section_id,
17
+ # workflow_state: enrollment.workflow_state
18
+ # }
19
+
20
+ def perform(payload)
21
+ super
22
+ return if course.nil? || section.nil? || user.nil?
23
+ attrs = {
25
24
  canvas_enrollment_id: local_canvas_id(payload[:enrollment_id]),
26
- course_id: course.try(:id),
27
- user_id: user.try(:id),
28
- type: payload[:type],
29
- section_id: section.try(:id),
30
- workflow_state: payload[:workflow_state]
31
- }
32
- create_or_update(attrs)
33
- rescue => e
34
- log_error e
35
- ensure
36
- true
37
- end
38
-
39
- private
40
- def create_or_update(attrs)
41
- enrollment = Enrollment.where(canvas_enrollment_id: attrs[:canvas_enrollment_id]).first_or_initialize
42
- enrollment.assign_attributes(attrs)
43
- enrollment.save!
44
- enrollment
45
- end
46
-
47
- def course
48
- @course ||= Course.find_by(canvas_course_id: local_canvas_id(payload[:course_id]))
49
- end
50
-
51
- def section
52
- @section ||= Section.find_by(canvas_section_id: local_canvas_id(payload[:section_id]))
53
- end
54
-
55
- def user
56
- @user ||= User.find_by(canvas_user_id: local_canvas_id(payload[:user_id]))
25
+ canvas_course_id: course.try(:id),
26
+ canvas_user_id: user.try(:id),
27
+ role: payload[:type],
28
+ canvas_section_id: section.try(:id),
29
+ status: payload[:workflow_state],
30
+ }
31
+ create_or_update(attrs)
32
+ end
33
+
34
+ private
35
+
36
+ def create_or_update(attrs)
37
+ enrollment = Enrollment.where(canvas_enrollment_id: attrs[:canvas_enrollment_id]).first_or_initialize
38
+ enrollment.assign_attributes(attrs)
39
+ enrollment.save!
40
+ enrollment
41
+ end
42
+
43
+ def course
44
+ @course ||= Course.find_by(canvas_course_id: local_canvas_id(payload[:course_id]))
45
+ end
46
+
47
+ def section
48
+ @section ||= Section.find_by(canvas_section_id: local_canvas_id(payload[:section_id]))
49
+ end
50
+
51
+ def user
52
+ @user ||= User.find_by(canvas_user_id: local_canvas_id(payload[:user_id]))
53
+ end
57
54
  end
58
- end
55
+ end
@@ -1,4 +1,6 @@
1
- <%= autogenerated_event_warning %>
1
+ # <%= autogenerated_event_warning %>
2
2
 
3
- class LiveEvents::EnrollmentUpdatedEvent < LiveEvents::EnrollmentEvent
4
- end
3
+ module LiveEvents
4
+ class EnrollmentUpdatedEvent < LiveEvents::EnrollmentEvent
5
+ end
6
+ end
@@ -1,4 +1,6 @@
1
- <%= autogenerated_event_warning %>
1
+ # <%= autogenerated_event_warning %>
2
2
 
3
- class LiveEvents::GradeChangedEvent < LiveEvents::GradeEvent
4
- end
3
+ module LiveEvents
4
+ class GradeChangedEvent < LiveEvents::GradeEvent
5
+ end
6
+ end
@@ -1,56 +1,55 @@
1
- <%= autogenerated_event_warning %>
1
+ # <%= autogenerated_event_warning %>
2
2
 
3
- class LiveEvents::GradeEvent < LiveEvents::BaseEvent
4
- # The following is provided in the live events call:
5
- # {
6
- # submission_id: submission.global_id,
7
- # assignment_id: submission.global_assignment_id,
8
- # grade: submission.grade,
9
- # old_grade: old_submission.try(:grade),
10
- # score: submission.score,
11
- # old_score: old_submission.try(:score),
12
- # points_possible: submission.assignment.points_possible,
13
- # old_points_possible: old_assignment.points_possible,
14
- # grader_id: grader_id,
15
- # student_id: submission.global_user_id,
16
- # user_id: submission.global_user_id,
17
- # grading_complete: submission.graded?,
18
- # muted: submission.muted_assignment?
19
- # }
3
+ module LiveEvents
4
+ class GradeEvent < LiveEvents::BaseEvent
5
+ # The following is provided in the live events call:
6
+ # {
7
+ # submission_id: submission.global_id,
8
+ # assignment_id: submission.global_assignment_id,
9
+ # grade: submission.grade,
10
+ # old_grade: old_submission.try(:grade),
11
+ # score: submission.score,
12
+ # old_score: old_submission.try(:score),
13
+ # points_possible: submission.assignment.points_possible,
14
+ # old_points_possible: old_assignment.points_possible,
15
+ # grader_id: grader_id,
16
+ # student_id: submission.global_user_id,
17
+ # user_id: submission.global_user_id,
18
+ # grading_complete: submission.graded?,
19
+ # muted: submission.muted_assignment?
20
+ # }
20
21
 
21
- def perform(event_payload)
22
- super
23
- attrs = {
24
- submission_id: submission.try(:id),
25
- assignment_id: assignment.try(:id),
26
- score: payload[:score],
27
- points_possible: payload[:points_possible],
28
- grader_id: payload[:grader_id],
29
- user_id: user.try(:id),
30
- grading_complete: payload[:grading_complete],
31
- muted: payload[:muted]
32
- }
33
- create_or_update(attrs)
34
- rescue => e
35
- log_error e
36
- ensure
37
- true
38
- end
22
+ def perform(event_payload)
23
+ super
24
+ attrs = {
25
+ submission_id: submission.try(:id),
26
+ assignment_id: assignment.try(:id),
27
+ score: payload[:score],
28
+ points_possible: payload[:points_possible],
29
+ grader_id: payload[:grader_id],
30
+ user_id: user.try(:id),
31
+ grading_complete: payload[:grading_complete],
32
+ muted: payload[:muted],
33
+ }
34
+ create_or_update(attrs)
35
+ end
39
36
 
40
- private
41
- def create_or_update(attrs)
42
- # Todo: add your code here
43
- end
37
+ private
44
38
 
45
- def submission
46
- Submission.find_by(canvas_submission_id: local_canvas_id(payload[:submission_id]))
47
- end
39
+ def create_or_update(attrs)
40
+ # TODO: add your code here
41
+ end
48
42
 
49
- def assignment
50
- Assignment.find_by(canvas_assignment_id: local_canvas_id(payload[:assignment_id]))
51
- end
43
+ def submission
44
+ Submission.find_by(canvas_submission_id: local_canvas_id(payload[:submission_id]))
45
+ end
46
+
47
+ def assignment
48
+ Assignment.find_by(canvas_assignment_id: local_canvas_id(payload[:assignment_id]))
49
+ end
52
50
 
53
- def user
54
- User.find_by(canvas_user_id: local_canvas_id(payload[:user_id]))
51
+ def user
52
+ User.find_by(canvas_user_id: local_canvas_id(payload[:user_id]))
53
+ end
55
54
  end
56
55
  end