Class: CanvasSync::Jobs::SyncProvisioningReportJob

Inherits:
ReportStarter show all
Defined in:
lib/canvas_sync/jobs/sync_provisioning_report_job.rb

Overview

ActiveJob class that starts a Canvas provisioning report

Instance Attribute Summary

Attributes inherited from CanvasSync::Job

#job_log

Instance Method Summary collapse

Methods inherited from CanvasSync::Job

#create_job_log, #report_checker_wait_time, #update_or_create_model

Instance Method Details

#perform(options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/canvas_sync/jobs/sync_provisioning_report_job.rb', line 5

def perform(options)
  params = {
    include_deleted: true,
  }

  options[:models].each do |model|
    # group_membership is the only model param that is singular :(
    model = 'group_membership' if model == 'group_memberships'

    params[model] = true
  end

  merged_params = merge_report_params(options, params, {}).with_indifferent_access

  # Make sure the report also checks last_activity_at when checking updated_at
  if options[:models].include?("enrollments")
    if (%w[last_activity_at total_activity_time] & CanvasSync::Concerns::SyncMapping.mapping_for(Enrollment)[:columns].keys).present? && merged_params.dig(:parameters, :include_last_activity) == nil
      merged_params[:parameters][:include_last_activity] = true
    end
  end

  super(
    "proservices_provisioning_csv",
    merged_params,
    CanvasSync::Processors::ProvisioningReportProcessor.to_s,
    options,
  )
end