Sha256: f27b097755a565d0a9de79780bd332f5888855c4d61c3588f3048133b4dcba9b
Contents?: true
Size: 1.46 KB
Versions: 4
Compression:
Stored size: 1.46 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 term_id = get_term_id(term) duped_job_chain = Marshal.load(Marshal.dump(job_chain)) duped_job_chain[:global_options][:canvas_term_id] = term_id start_report(report_params(options, 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 def get_term_id(term) term.try(:canvas_id) || term.canvas_term_id end end end end
Version data entries
4 entries across 4 versions & 1 rubygems