Class: CanvasSync::Processors::AssignmentOverridesProcessor

Inherits:
ReportProcessor
  • Object
show all
Defined in:
lib/canvas_sync/processors/assignment_overrides_processor.rb

Overview

Processes a assignment overrides report using the bulk importer.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ReportProcessor

#do_bulk_import, #mapping, #mapping_for

Constructor Details

#initialize(report_file_path, options) ⇒ AssignmentOverridesProcessor

Returns a new instance of AssignmentOverridesProcessor.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/canvas_sync/processors/assignment_overrides_processor.rb', line 15

def initialize(report_file_path, options)
  do_bulk_import(report_file_path, AssignmentOverride, options: options) do |row|
    # Handle transforms here instead of in mappings
    row[:student_ids]       = parse_student_ids(row[:student_ids])

    # Convert empty/null/'0' values to nil
    # For Ruby 2.7
    row[:group_id]          = parse_nil_value(row[:group_id])
    row[:course_section_id] = parse_nil_value(row[:course_section_id])
    row
  end
end

Class Method Details

.process(report_file_path, options, report_id) ⇒ Object

Class method that starts processing (for consistent interface with other processors).



11
12
13
# File 'lib/canvas_sync/processors/assignment_overrides_processor.rb', line 11

def self.process(report_file_path, options, report_id)
  new(report_file_path, options)
end