Class: CanvasSync::Jobs::SyncSimpleTableJob
Instance Method Summary
collapse
#create_job_log, #report_checker_wait_time, #update_or_create_model
Instance Method Details
#get_term_id(term) ⇒ Object
51
52
53
|
# File 'lib/canvas_sync/jobs/sync_simple_table_job.rb', line 51
def get_term_id(term)
term.try(:canvas_id) || term.canvas_term_id
end
|
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
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/canvas_sync/jobs/sync_simple_table_job.rb', line 10
def perform(job_chain, options)
if options[:term_scope]
sub_reports = CanvasSync.fork(@job_log, job_chain, keys: [:canvas_term_id]) do |job_chain|
Term.send(options[:term_scope]).find_each.map do |term|
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
{
job_chain: duped_job_chain,
params: report_params(options, term_id),
options: options,
}
end
end
sub_reports.each do |r|
start_report(r[:params], r[:job_chain], r[:options])
end
else
start_report(report_params(options), job_chain, options)
end
end
|
#report_params(options, canvas_term_id = nil) ⇒ Object
45
46
47
48
49
|
# File 'lib/canvas_sync/jobs/sync_simple_table_job.rb', line 45
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
|
#start_report(params, job_chain, options) ⇒ Object