Sha256: 9177c303ac513084cb337591a989ac1ed948f9b2822b2d4dad2dbb2c28db46ed
Contents?: true
Size: 1.64 KB
Versions: 2
Compression:
Stored size: 1.64 KB
Contents
# <%= autogenerated_event_warning %> module LiveEvents class CourseSectionEvent < LiveEvents::BaseEvent # The following is provided in the live events call: # { # course_section_id: section.id, # sis_id: section.sis_id, # sis_batch_id: section.sis_batch_id, # course_id: section.course_id, # root_account_id: section.root_account_id, # enrollment_term_id: section.enrollment_term_id, # name: section.name, # default_section: section.default_section, # accepting_enrollments: section.accepting_enrollments, # can_manually_enroll: section.can_manually_enroll, # start_at: section.start_at, # end_at: section.end_at, # workflow_state: section.workflow_state, # restrict_enrollments_to_section_dates: section.restrict_enrollments_to_section_dates, # nonxlist_course_id: section.nonxlist_course_id, # stuck_sis_fields: section.stuck_sis_fields, # integration_id: section.integration_id # } def perform(_event_payload) super attrs = { canvas_section_id: local_canvas_id(payload[:course_section_id]), canvas_course_id: local_canvas_id(payload[:course_id]), name: payload[:name], workflow_state: payload[:workflow_state], start_at: payload[:start_at], end_at: payload[:end_at], canvas_nonxlist_course_id: payload[:nonxlist_course_id], } create_or_update(attrs) end private def create_or_update(attrs) section = Section.where(canvas_section_id: attrs[:canvas_section_id]).first_or_initialize section.assign_attributes(attrs) section.save! end end end
Version data entries
2 entries across 2 versions & 1 rubygems