Sha256: 24571725646073ce2343f4c1f9731c0677dc45b2bc67aa91e1c7a838425d9982
Contents?: true
Size: 1.36 KB
Versions: 10
Compression:
Stored size: 1.36 KB
Contents
module CanvasSync module Jobs class SyncSimpleTableJob < ReportStarter # # Starts a report processor for the specified report # (the specified report must be enabled) # # @param job_chain [Hash] # @param options [Hash] 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 def start_report(params, job_chain, options) CanvasSync::Jobs::ReportStarter.perform_later( job_chain, options[:report_name], params, CanvasSync::Processors::NormalProcessor.to_s, options, ) end def report_params(options, canvas_term_id=nil) params = options[:params] || {} params["parameters[enrollment_term_id]"] = canvas_term_id if canvas_term_id params end end end end
Version data entries
10 entries across 10 versions & 1 rubygems