Class: CanvasSync::Jobs::SyncSimpleTableJob
- Inherits:
-
ReportStarter
- Object
- ActiveJob::Base
- CanvasSync::Job
- ReportStarter
- CanvasSync::Jobs::SyncSimpleTableJob
- Defined in:
- lib/canvas_sync/jobs/sync_simple_table_job.rb
Instance Method Summary collapse
-
#perform(job_chain, options) ⇒ Object
Starts a report processor for the specified report (the specified report must be enabled).
- #report_params(options, canvas_term_id = nil) ⇒ Object
- #start_report(params, job_chain, options) ⇒ Object
Methods inherited from CanvasSync::Job
#create_job_log, #report_checker_wait_time
Instance Method Details
#perform(job_chain, options) ⇒ Object
Starts a report processor for the specified report (the specified report must be enabled)
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/canvas_sync/jobs/sync_simple_table_job.rb', line 10 def perform(job_chain, ) if [:term_scope] Term.send([: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(, term.canvas_term_id), duped_job_chain, ) end else start_report(report_params(), job_chain, ) end end |
#report_params(options, canvas_term_id = nil) ⇒ Object
34 35 36 37 38 |
# File 'lib/canvas_sync/jobs/sync_simple_table_job.rb', line 34 def report_params(, canvas_term_id=nil) params = [:params] || {} params["parameters[enrollment_term_id]"] = canvas_term_id if canvas_term_id params end |
#start_report(params, job_chain, options) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/canvas_sync/jobs/sync_simple_table_job.rb', line 24 def start_report(params, job_chain, ) CanvasSync::Jobs::ReportStarter.perform_later( job_chain, [:report_name], params, CanvasSync::Processors::NormalProcessor.to_s, , ) end |