Class: CanvasSync::Jobs::SyncProvisioningReportJob

Inherits:
CanvasSync::Job
  • Object
show all
Defined in:
lib/canvas_sync/jobs/sync_provisioning_report_job.rb

Overview

ActiveJob class that starts a Canvas provisioning report

Instance Method Summary collapse

Methods inherited from CanvasSync::Job

#create_job_log, #report_checker_wait_time

Instance Method Details

#perform(job_chain, options) ⇒ Object

Parameters:

  • job_chain (Hash)
  • options (Hash)

    If options contains a :term_scope a seperate provisioning report will be started for each term in that scope. :models should be an array of models to sync.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/canvas_sync/jobs/sync_provisioning_report_job.rb', line 9

def perform(job_chain, options)
  if options[:term_scope]
    Term.send(options[:term_scope]).find_each do |term|
      # Deep copy the job_chain so each report gets the correct term id passed into
      # its options with no side effects
      duped_job_chain = Marshal.load(Marshal.dump(job_chain))
      duped_job_chain[:global_options][:canvas_term_id] = term.canvas_term_id
      start_report(report_params(options, term.canvas_term_id), duped_job_chain, options)
    end
  else
    start_report(report_params(options), job_chain, options)
  end
end