Sha256: e137d70604c98019b21cdcb2fedff3949083958357fcbd9cad4e94e9027d2188
Contents?: true
Size: 1.67 KB
Versions: 36
Compression:
Stored size: 1.67 KB
Contents
module CanvasSync module Jobs # ActiveJob class that starts a Canvas provisioning report class SyncProvisioningReportJob < CanvasSync::Job # @param job_chain [Hash] # @param 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. 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 private def start_report(report_params, job_chain, options) CanvasSync::Jobs::ReportStarter.perform_later( job_chain, "proservices_provisioning_csv", report_params, CanvasSync::Processors::ProvisioningReportProcessor.to_s, options, ) end def report_params(options, canvas_term_id=nil) params = { "parameters[include_deleted]" => true } options[:models].each do |model| params["parameters[#{model}]"] = true end params["parameters[enrollment_term_id]"] = canvas_term_id if canvas_term_id params end end end end
Version data entries
36 entries across 36 versions & 1 rubygems