canvas_sync 0.16.5 → 0.17.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +49 -137
  3. data/app/models/canvas_sync/sync_batch.rb +5 -0
  4. data/db/migrate/20201018210836_create_canvas_sync_sync_batches.rb +11 -0
  5. data/lib/canvas_sync/importers/bulk_importer.rb +4 -7
  6. data/lib/canvas_sync/job.rb +4 -10
  7. data/lib/canvas_sync/job_batches/batch.rb +399 -0
  8. data/lib/canvas_sync/job_batches/batch_aware_job.rb +62 -0
  9. data/lib/canvas_sync/job_batches/callback.rb +153 -0
  10. data/lib/canvas_sync/job_batches/chain_builder.rb +203 -0
  11. data/lib/canvas_sync/job_batches/context_hash.rb +147 -0
  12. data/lib/canvas_sync/job_batches/jobs/base_job.rb +7 -0
  13. data/lib/canvas_sync/job_batches/jobs/concurrent_batch_job.rb +18 -0
  14. data/lib/canvas_sync/job_batches/jobs/serial_batch_job.rb +73 -0
  15. data/lib/canvas_sync/job_batches/sidekiq.rb +91 -0
  16. data/lib/canvas_sync/job_batches/status.rb +63 -0
  17. data/lib/canvas_sync/jobs/begin_sync_chain_job.rb +34 -0
  18. data/lib/canvas_sync/jobs/report_checker.rb +3 -6
  19. data/lib/canvas_sync/jobs/report_processor_job.rb +2 -5
  20. data/lib/canvas_sync/jobs/report_starter.rb +28 -20
  21. data/lib/canvas_sync/jobs/sync_accounts_job.rb +3 -5
  22. data/lib/canvas_sync/jobs/sync_admins_job.rb +2 -4
  23. data/lib/canvas_sync/jobs/sync_assignment_groups_job.rb +2 -4
  24. data/lib/canvas_sync/jobs/sync_assignments_job.rb +2 -4
  25. data/lib/canvas_sync/jobs/sync_context_module_items_job.rb +2 -4
  26. data/lib/canvas_sync/jobs/sync_context_modules_job.rb +2 -4
  27. data/lib/canvas_sync/jobs/sync_provisioning_report_job.rb +4 -31
  28. data/lib/canvas_sync/jobs/sync_roles_job.rb +2 -5
  29. data/lib/canvas_sync/jobs/sync_simple_table_job.rb +11 -32
  30. data/lib/canvas_sync/jobs/sync_submissions_job.rb +2 -4
  31. data/lib/canvas_sync/jobs/sync_terms_job.rb +22 -7
  32. data/lib/canvas_sync/processors/assignment_groups_processor.rb +2 -3
  33. data/lib/canvas_sync/processors/assignments_processor.rb +2 -3
  34. data/lib/canvas_sync/processors/context_module_items_processor.rb +2 -3
  35. data/lib/canvas_sync/processors/context_modules_processor.rb +2 -3
  36. data/lib/canvas_sync/processors/normal_processor.rb +1 -2
  37. data/lib/canvas_sync/processors/provisioning_report_processor.rb +2 -10
  38. data/lib/canvas_sync/processors/submissions_processor.rb +2 -3
  39. data/lib/canvas_sync/version.rb +1 -1
  40. data/lib/canvas_sync.rb +34 -97
  41. data/spec/canvas_sync/canvas_sync_spec.rb +126 -153
  42. data/spec/canvas_sync/jobs/job_spec.rb +9 -17
  43. data/spec/canvas_sync/jobs/report_checker_spec.rb +1 -3
  44. data/spec/canvas_sync/jobs/report_processor_job_spec.rb +0 -3
  45. data/spec/canvas_sync/jobs/report_starter_spec.rb +19 -28
  46. data/spec/canvas_sync/jobs/sync_admins_job_spec.rb +1 -4
  47. data/spec/canvas_sync/jobs/sync_assignment_groups_job_spec.rb +2 -1
  48. data/spec/canvas_sync/jobs/sync_assignments_job_spec.rb +3 -2
  49. data/spec/canvas_sync/jobs/sync_context_module_items_job_spec.rb +3 -2
  50. data/spec/canvas_sync/jobs/sync_context_modules_job_spec.rb +3 -2
  51. data/spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb +3 -35
  52. data/spec/canvas_sync/jobs/sync_roles_job_spec.rb +1 -4
  53. data/spec/canvas_sync/jobs/sync_simple_table_job_spec.rb +5 -12
  54. data/spec/canvas_sync/jobs/sync_submissions_job_spec.rb +2 -1
  55. data/spec/canvas_sync/jobs/sync_terms_job_spec.rb +1 -4
  56. data/spec/dummy/config/environments/test.rb +2 -0
  57. data/spec/dummy/db/schema.rb +9 -1
  58. data/spec/job_batching/batch_aware_job_spec.rb +100 -0
  59. data/spec/job_batching/batch_spec.rb +363 -0
  60. data/spec/job_batching/callback_spec.rb +38 -0
  61. data/spec/job_batching/flow_spec.rb +91 -0
  62. data/spec/job_batching/integration/integration.rb +57 -0
  63. data/spec/job_batching/integration/nested.rb +88 -0
  64. data/spec/job_batching/integration/simple.rb +47 -0
  65. data/spec/job_batching/integration/workflow.rb +134 -0
  66. data/spec/job_batching/integration_helper.rb +48 -0
  67. data/spec/job_batching/sidekiq_spec.rb +124 -0
  68. data/spec/job_batching/status_spec.rb +92 -0
  69. data/spec/job_batching/support/base_job.rb +14 -0
  70. data/spec/job_batching/support/sample_callback.rb +2 -0
  71. data/spec/spec_helper.rb +10 -0
  72. metadata +91 -23
  73. data/lib/canvas_sync/job_chain.rb +0 -102
  74. data/lib/canvas_sync/jobs/fork_gather.rb +0 -74
  75. data/spec/canvas_sync/jobs/fork_gather_spec.rb +0 -73
  76. data/spec/dummy/db/test.sqlite3 +0 -0
  77. data/spec/dummy/log/development.log +0 -1248
  78. data/spec/dummy/log/test.log +0 -43258
  79. data/spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv +0 -3
  80. data/spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv +0 -4
@@ -2,7 +2,6 @@ module CanvasSync
2
2
  module Jobs
3
3
  # Starts a Canvas report and enqueues a ReportChecker
4
4
  class ReportStarter < CanvasSync::Job
5
- # @param job_chain [Hash]
6
5
  # @param report_name [Hash] e.g., 'provisioning_csv'
7
6
  # @param report_params [Hash] The Canvas report parameters
8
7
  # @param processor [String] a stringified report processor class name
@@ -10,31 +9,39 @@ module CanvasSync
10
9
  # @param allow_redownloads [Boolean] whether you want the job_chain to cache this report,
11
10
  # so that any later jobs in the chain will use the same generated report
12
11
  # @return [nil]
13
- def perform(job_chain, report_name, report_params, processor, options, allow_redownloads: false)
14
- account_id = options[:account_id] || job_chain[:global_options][:account_id] || "self"
15
- options[:sync_start_time] = DateTime.now.utc.iso8601
16
- report_id = if allow_redownloads
17
- get_cached_report(job_chain, account_id, report_name, report_params)
18
- else
19
- start_report(job_chain, account_id, report_name, report_params)
20
- end
12
+ def perform(report_name, report_params, processor, options, allow_redownloads: false)
13
+ account_id = options[:account_id] || batch_context[:account_id] || "self"
21
14
 
22
- CanvasSync::Jobs::ReportChecker.set(wait: report_checker_wait_time).perform_later(
23
- job_chain,
24
- report_name,
25
- report_id,
26
- processor,
27
- options,
28
- )
15
+ report_id = start_report(account_id, report_name, report_params)
16
+ # TODO: Restore report caching support (does nayone actually use it?)
17
+ # report_id = if allow_redownloads
18
+ # get_cached_report(account_id, report_name, report_params)
19
+ # else
20
+ # start_report(account_id, report_name, report_params)
21
+ # end
22
+
23
+ batch = JobBatches::Batch.new
24
+ batch.description = "CanvasSync #{report_name} Fiber"
25
+ batch.jobs do
26
+ CanvasSync::Jobs::ReportChecker.set(wait: report_checker_wait_time).perform_later(
27
+ report_name,
28
+ report_id,
29
+ processor,
30
+ options,
31
+ )
32
+ end
29
33
  end
30
34
 
31
35
  protected
32
36
 
33
- def merge_report_params(job_chain, options={}, params={}, term_scope: true)
34
- term_scope = job_chain[:global_options][:canvas_term_id] if term_scope == true
37
+ def merge_report_params(options={}, params={}, term_scope: true)
38
+ term_scope = batch_context[:canvas_term_id] if term_scope == true
35
39
  if term_scope.present?
36
40
  params[:enrollment_term_id] = term_scope
37
41
  end
42
+ if (updated_after = batch_context[:updated_after]).present?
43
+ params[:updated_after] = updated_after
44
+ end
38
45
  params.merge!(options[:report_params]) if options[:report_params].present?
39
46
  { parameters: params }
40
47
  end
@@ -42,6 +49,7 @@ module CanvasSync
42
49
  private
43
50
 
44
51
  def get_cached_report(job_chain, account_id, report_name, report_params)
52
+ # TODO: job_chain[:global_options] is no longer available and batch_context won't work for this
45
53
  if job_chain[:global_options][report_name].present?
46
54
  job_chain[:global_options][report_name]
47
55
  else
@@ -51,8 +59,8 @@ module CanvasSync
51
59
  end
52
60
  end
53
61
 
54
- def start_report(job_chain, account_id, report_name, report_params)
55
- report = CanvasSync.get_canvas_sync_client(job_chain[:global_options])
62
+ def start_report(account_id, report_name, report_params)
63
+ report = CanvasSync.get_canvas_sync_client(batch_context)
56
64
  .start_report(account_id, report_name, report_params)
57
65
  report["id"]
58
66
  end
@@ -7,18 +7,16 @@ module CanvasSync
7
7
  # running provisioning by term we sync users first so we don't duplicate
8
8
  # the work of syncing all accounts for each term.
9
9
  #
10
- # @param job_chain [Hash]
11
10
  # @param options [Hash]
12
- def perform(job_chain, options)
11
+ def perform(options)
13
12
  unless options[:root_account] == false
14
- acc_params = CanvasSync.get_canvas_sync_client(job_chain[:global_options]).account("self")
13
+ acc_params = CanvasSync.get_canvas_sync_client(batch_context).account("self")
15
14
  update_or_create_model(Account, acc_params)
16
15
  end
17
16
 
18
17
  super(
19
- job_chain,
20
18
  "proservices_provisioning_csv",
21
- merge_report_params(job_chain, options, {
19
+ merge_report_params(options, {
22
20
  accounts: true,
23
21
  include_deleted: true,
24
22
  }, term_scope: false),
@@ -4,11 +4,10 @@ module CanvasSync
4
4
  # Syncs Admins using the Canvas API
5
5
  #
6
6
  #
7
- # @param job_chain [Hash]
8
7
  # @param options [Hash]
9
- def perform(job_chain, _options)
8
+ def perform(options)
10
9
  updated_admin_ids = []
11
- api_client = CanvasSync.get_canvas_sync_client(job_chain[:global_options])
10
+ api_client = CanvasSync.get_canvas_sync_client(batch_context)
12
11
  CanvasSync.sync_scope(Account).find_each do |acc|
13
12
  api_client.account_admins(acc.canvas_id).all_pages_each do |admin_params|
14
13
  admin_params[:account_id] = acc.canvas_id
@@ -17,7 +16,6 @@ module CanvasSync
17
16
  end
18
17
  end
19
18
  Admin.where.not(id: updated_admin_ids).update_all(workflow_state: 'inactive')
20
- CanvasSync.invoke_next(job_chain)
21
19
  end
22
20
  end
23
21
  end
@@ -6,13 +6,11 @@ module CanvasSync
6
6
  # Starts a report processor for the assignment_groups report
7
7
  # (the proserv_assignment_group_export_csv report must be enabled)
8
8
  #
9
- # @param job_chain [Hash]
10
9
  # @param options [Hash]
11
- def perform(job_chain, options)
10
+ def perform(options)
12
11
  super(
13
- job_chain,
14
12
  "proserv_assignment_group_export_csv",
15
- merge_report_params(job_chain, options),
13
+ merge_report_params(options),
16
14
  CanvasSync::Processors::AssignmentGroupsProcessor.to_s,
17
15
  {},
18
16
  )
@@ -6,13 +6,11 @@ module CanvasSync
6
6
  # Starts a report processor for the assignment report
7
7
  # (the proserv_assignment_export_csv report must be enabled)
8
8
  #
9
- # @param job_chain [Hash]
10
9
  # @param options [Hash]
11
- def perform(job_chain, options)
10
+ def perform(options)
12
11
  super(
13
- job_chain,
14
12
  "proserv_assignment_export_csv",
15
- merge_report_params(job_chain, options),
13
+ merge_report_params(options),
16
14
  CanvasSync::Processors::AssignmentsProcessor.to_s,
17
15
  {},
18
16
  )
@@ -6,13 +6,11 @@ module CanvasSync
6
6
  # Starts a report processor for the context modules report
7
7
  # (the proserv_context_module_items_csv report must be enabled)
8
8
  #
9
- # @param job_chain [Hash]
10
9
  # @param options [Hash]
11
- def perform(job_chain, options)
10
+ def perform(options)
12
11
  super(
13
- job_chain,
14
12
  "proserv_context_module_items_csv",
15
- merge_report_params(job_chain, options),
13
+ merge_report_params(options),
16
14
  CanvasSync::Processors::ContextModuleItemsProcessor.to_s,
17
15
  {},
18
16
  )
@@ -6,13 +6,11 @@ module CanvasSync
6
6
  # Starts a report processor for the context modules report
7
7
  # (the proserv_context_modules_csv report must be enabled)
8
8
  #
9
- # @param job_chain [Hash]
10
9
  # @param options [Hash]
11
- def perform(job_chain, options)
10
+ def perform(options)
12
11
  super(
13
- job_chain,
14
12
  "proserv_context_modules_csv",
15
- merge_report_params(job_chain, options),
13
+ merge_report_params(options),
16
14
  CanvasSync::Processors::ContextModulesProcessor.to_s,
17
15
  {},
18
16
  )
@@ -2,40 +2,17 @@ module CanvasSync
2
2
  module Jobs
3
3
  # ActiveJob class that starts a Canvas provisioning report
4
4
  class SyncProvisioningReportJob < CanvasSync::Job
5
- # @param job_chain [Hash]
6
5
  # @param options [Hash] If options contains a :term_scope a seperate provisioning report
7
6
  # will be started for each term in that scope. :models should be an array of
8
7
  # models to sync.
9
- def perform(job_chain, options)
10
- if options[:term_scope]
11
- sub_reports = CanvasSync.fork(@job_log, job_chain, keys: [:canvas_term_id]) do |fork_template|
12
- Term.send(options[:term_scope]).find_each.map do |term|
13
- fork = fork_template.duplicate
14
- # Deep copy the job_chain so each report gets the correct term id passed into
15
- # its options with no side effects
16
- term_id = get_term_id(term)
17
- fork[:global_options][:canvas_term_id] = term_id
18
- {
19
- job_chain: fork.serialize,
20
- params: report_params(options, term_id),
21
- options: options,
22
- }
23
- end
24
- end
25
-
26
- sub_reports.each do |r|
27
- start_report(r[:params], r[:job_chain], r[:options])
28
- end
29
- else
30
- start_report(report_params(options), job_chain, options)
31
- end
8
+ def perform(options)
9
+ start_report(report_params(options), options)
32
10
  end
33
11
 
34
12
  protected
35
13
 
36
- def start_report(report_params, job_chain, options)
14
+ def start_report(report_params, options)
37
15
  CanvasSync::Jobs::ReportStarter.perform_later(
38
- job_chain,
39
16
  "proservices_provisioning_csv",
40
17
  report_params,
41
18
  CanvasSync::Processors::ProvisioningReportProcessor.to_s,
@@ -43,7 +20,7 @@ module CanvasSync
43
20
  )
44
21
  end
45
22
 
46
- def report_params(options, canvas_term_id=nil)
23
+ def report_params(options, canvas_term_id = options[:canvas_term_id] || batch_context[:canvas_term_id])
47
24
  params = {
48
25
  include_deleted: true,
49
26
  }
@@ -60,10 +37,6 @@ module CanvasSync
60
37
 
61
38
  { parameters: params }
62
39
  end
63
-
64
- def get_term_id(term)
65
- term.try(:canvas_id) || term.canvas_term_id
66
- end
67
40
  end
68
41
  end
69
42
  end
@@ -3,12 +3,10 @@ module CanvasSync
3
3
  class SyncRolesJob < CanvasSync::Job
4
4
  # Syncs Roles using the Canvas API
5
5
  #
6
- #
7
- # @param job_chain [Hash]
8
6
  # @param options [Hash]
9
- def perform(job_chain, _options)
7
+ def perform(options)
10
8
  updated_role_ids = []
11
- api_client = CanvasSync.get_canvas_sync_client(job_chain[:global_options])
9
+ api_client = CanvasSync.get_canvas_sync_client(batch_context)
12
10
  CanvasSync.sync_scope(Account).find_each do |acc|
13
11
  api_client.list_roles(acc.canvas_id, state: %w[active inactive]).all_pages_each do |role_params|
14
12
  role = update_or_create_model(Role, role_params)
@@ -16,7 +14,6 @@ module CanvasSync
16
14
  end
17
15
  end
18
16
  Role.where.not(id: updated_role_ids).update_all(workflow_state: 'inactive')
19
- CanvasSync.invoke_next(job_chain)
20
17
  end
21
18
  end
22
19
  end
@@ -5,36 +5,19 @@ module CanvasSync
5
5
  # Starts a report processor for the specified report
6
6
  # (the specified report must be enabled)
7
7
  #
8
- # @param job_chain [Hash]
9
- # @param options [Hash]
10
- def perform(job_chain, options)
11
- if options[:term_scope]
12
- sub_reports = CanvasSync.fork(@job_log, job_chain, keys: [:canvas_term_id]) do |fork_template|
13
- Term.send(options[:term_scope]).find_each.map do |term|
14
- fork = fork_template.duplicate
15
- # Deep copy the job_chain so each report gets the correct term id passed into
16
- # its options with no side effects
17
- term_id = get_term_id(term)
18
- fork[:global_options][:canvas_term_id] = term_id
19
- {
20
- job_chain: fork.serialize,
21
- params: report_params(options, term_id),
22
- options: options,
23
- }
24
- end
25
- end
26
-
27
- sub_reports.each do |r|
28
- start_report(r[:params], r[:job_chain], r[:options])
29
- end
30
- else
31
- start_report(report_params(options), job_chain, options)
32
- end
8
+ # @param options [Hash] {
9
+ # report_name: "", # Name of the report in the Canvas API
10
+ # model: , # Model to map the report results as
11
+ # mapping: {} # Mapping to describe how to convert the report to the Model,
12
+ # klass: ,
13
+ # params: {}, # List of params to pass to the report
14
+ # }
15
+ def perform(options)
16
+ start_report(report_params(options), options)
33
17
  end
34
18
 
35
- def start_report(params, job_chain, options)
19
+ def start_report(params, options)
36
20
  CanvasSync::Jobs::ReportStarter.perform_later(
37
- job_chain,
38
21
  options[:report_name],
39
22
  params,
40
23
  CanvasSync::Processors::NormalProcessor.to_s,
@@ -42,15 +25,11 @@ module CanvasSync
42
25
  )
43
26
  end
44
27
 
45
- def report_params(options, canvas_term_id=nil)
28
+ def report_params(options, canvas_term_id = options[:canvas_term_id] || batch_context[:canvas_term_id])
46
29
  params = options[:params] || {}
47
30
  params["parameters[enrollment_term_id]"] = canvas_term_id if canvas_term_id
48
31
  params
49
32
  end
50
-
51
- def get_term_id(term)
52
- term.try(:canvas_id) || term.canvas_term_id
53
- end
54
33
  end
55
34
  end
56
35
  end
@@ -6,13 +6,11 @@ module CanvasSync
6
6
  # Starts a report processor for the submission report
7
7
  # (the proserv_student_submissions_csv report must be enabled)
8
8
  #
9
- # @param job_chain [Hash]
10
9
  # @param options [Hash]
11
- def perform(job_chain, options)
10
+ def perform(options)
12
11
  super(
13
- job_chain,
14
12
  "proserv_student_submissions_csv",
15
- merge_report_params(job_chain, options, { include_all: options[:include_all] }, {}),
13
+ merge_report_params(options, { include_all: options[:include_all] }, {}),
16
14
  CanvasSync::Processors::SubmissionsProcessor.to_s,
17
15
  {},
18
16
  )
@@ -5,16 +5,15 @@ module CanvasSync
5
5
  #
6
6
  # Terms are pre-synced so that provisioning reports can be scoped to term.
7
7
  #
8
- # @param job_chain [Hash]
9
8
  # @param options [Hash]
10
- def perform(job_chain, _options)
11
- CanvasSync.get_canvas_sync_client(job_chain[:global_options]).terms("self").all_pages!.each do |term_params|
12
- if job_chain[:global_options][:account_id]
9
+ def perform(options)
10
+ CanvasSync.get_canvas_sync_client(batch_context).terms("self").all_pages!.each do |term_params|
11
+ if account_id = batch_context[:account_id]
13
12
  # These branches are primarily to support Legacy apps
14
13
  if Term.respond_to?(:create_or_update) && Term.method(:create_or_update).arity.abs == 2
15
- Term.create_or_update(term_params, job_chain[:global_options][:account_id])
14
+ Term.create_or_update(term_params, account_id)
16
15
  else
17
- term_params[:account_id] |= job_chain[:global_options][:account_id]
16
+ term_params[:account_id] |= account_id
18
17
  update_or_create_model(Term, term_params)
19
18
  end
20
19
  else
@@ -22,7 +21,23 @@ module CanvasSync
22
21
  end
23
22
  end
24
23
 
25
- CanvasSync.invoke_next(job_chain)
24
+ if (jobs = options[:sub_jobs]).present?
25
+ context = options[:context] || {}
26
+ if options[:term_scope]
27
+ Term.send(options[:term_scope]).find_each.map do |term|
28
+ local_context = context.merge(canvas_term_id: get_term_id(term))
29
+ JobBatches::ConcurrentBatchJob.perform_now(jobs, context: local_context)
30
+ end
31
+ else
32
+ JobBatches::ConcurrentBatchJob.perform_now(jobs, context: context)
33
+ end
34
+ end
35
+ end
36
+
37
+ protected
38
+
39
+ def get_term_id(term)
40
+ term.try(:canvas_id) || term.canvas_term_id
26
41
  end
27
42
  end
28
43
  end
@@ -8,16 +8,15 @@ module CanvasSync
8
8
  # @param options [Hash]
9
9
  class AssignmentGroupsProcessor < ReportProcessor
10
10
  def self.process(report_file_path, _options, report_id)
11
- new(report_file_path, _options)
11
+ new(report_file_path)
12
12
  end
13
13
 
14
- def initialize(report_file_path, options)
14
+ def initialize(report_file_path)
15
15
  CanvasSync::Importers::BulkImporter.import(
16
16
  report_file_path,
17
17
  mapping[:assignment_groups][:report_columns],
18
18
  AssignmentGroup,
19
19
  mapping[:assignment_groups][:conflict_target].to_sym,
20
- import_args: options
21
20
  )
22
21
  end
23
22
  end
@@ -8,16 +8,15 @@ module CanvasSync
8
8
  # @param options [Hash]
9
9
  class AssignmentsProcessor < ReportProcessor
10
10
  def self.process(report_file_path, _options, report_id)
11
- new(report_file_path, _options)
11
+ new(report_file_path)
12
12
  end
13
13
 
14
- def initialize(report_file_path, options)
14
+ def initialize(report_file_path)
15
15
  CanvasSync::Importers::BulkImporter.import(
16
16
  report_file_path,
17
17
  mapping[:assignments][:report_columns],
18
18
  Assignment,
19
19
  mapping[:assignments][:conflict_target].to_sym,
20
- import_args: options
21
20
  )
22
21
  end
23
22
  end
@@ -8,16 +8,15 @@ module CanvasSync
8
8
  # @param options [Hash]
9
9
  class ContextModuleItemsProcessor < ReportProcessor
10
10
  def self.process(report_file_path, _options, report_id)
11
- new(report_file_path, _options)
11
+ new(report_file_path)
12
12
  end
13
13
 
14
- def initialize(report_file_path, options)
14
+ def initialize(report_file_path)
15
15
  CanvasSync::Importers::BulkImporter.import(
16
16
  report_file_path,
17
17
  mapping[:context_module_items][:report_columns],
18
18
  ContextModuleItem,
19
19
  mapping[:context_module_items][:conflict_target].to_sym,
20
- import_args: options
21
20
  )
22
21
  end
23
22
  end
@@ -8,16 +8,15 @@ module CanvasSync
8
8
  # @param options [Hash]
9
9
  class ContextModulesProcessor < ReportProcessor
10
10
  def self.process(report_file_path, _options, report_id)
11
- new(report_file_path, _options)
11
+ new(report_file_path)
12
12
  end
13
13
 
14
- def initialize(report_file_path, options)
14
+ def initialize(report_file_path)
15
15
  CanvasSync::Importers::BulkImporter.import(
16
16
  report_file_path,
17
17
  mapping[:context_modules][:report_columns],
18
18
  ContextModule,
19
19
  mapping[:context_modules][:conflict_target].to_sym,
20
- import_args: options
21
20
  )
22
21
  end
23
22
  end
@@ -18,8 +18,7 @@ module CanvasSync
18
18
  report_file_path,
19
19
  mapping[options[:mapping].to_sym][:report_columns],
20
20
  options[:klass].constantize,
21
- conflict_target ? conflict_target.to_sym : conflict_target,
22
- import_args: options
21
+ conflict_target ? conflict_target.to_sym : conflict_target
23
22
  )
24
23
  end
25
24
  end
@@ -21,6 +21,7 @@ module CanvasSync
21
21
 
22
22
  def initialize(report_file_path, options) # rubocop:disable Metrics/AbcSize
23
23
  @options = options
24
+
24
25
  if options[:models].length == 1
25
26
  run_import(options[:models][0], report_file_path)
26
27
  else
@@ -74,7 +75,6 @@ module CanvasSync
74
75
  mapping[:users][:report_columns],
75
76
  User,
76
77
  mapping[:users][:conflict_target].to_sym,
77
- import_args: @options
78
78
  )
79
79
  end
80
80
 
@@ -84,7 +84,6 @@ module CanvasSync
84
84
  mapping[:pseudonyms][:report_columns],
85
85
  Pseudonym,
86
86
  mapping[:pseudonyms][:conflict_target].to_sym,
87
- import_args: @options
88
87
  )
89
88
  end
90
89
 
@@ -93,8 +92,7 @@ module CanvasSync
93
92
  report_file_path,
94
93
  mapping[:accounts][:report_columns],
95
94
  Account,
96
- mapping[:accounts][:conflict_target].to_sym,
97
- import_args: @options
95
+ mapping[:accounts][:conflict_target].to_sym
98
96
  )
99
97
  end
100
98
 
@@ -104,7 +102,6 @@ module CanvasSync
104
102
  mapping[:courses][:report_columns],
105
103
  Course,
106
104
  mapping[:courses][:conflict_target].to_sym,
107
- import_args: @options
108
105
  )
109
106
  end
110
107
 
@@ -114,7 +111,6 @@ module CanvasSync
114
111
  mapping[:enrollments][:report_columns],
115
112
  Enrollment,
116
113
  mapping[:enrollments][:conflict_target].to_sym,
117
- import_args: @options
118
114
  )
119
115
  end
120
116
 
@@ -124,7 +120,6 @@ module CanvasSync
124
120
  mapping[:sections][:report_columns],
125
121
  Section,
126
122
  mapping[:sections][:conflict_target].to_sym,
127
- import_args: @options
128
123
  )
129
124
  end
130
125
 
@@ -134,7 +129,6 @@ module CanvasSync
134
129
  mapping[:xlist][:report_columns],
135
130
  Section,
136
131
  mapping[:xlist][:conflict_target].to_sym,
137
- import_args: @options
138
132
  )
139
133
  end
140
134
 
@@ -144,7 +138,6 @@ module CanvasSync
144
138
  mapping[:groups][:report_columns],
145
139
  Group,
146
140
  mapping[:groups][:conflict_target].to_sym,
147
- import_args: @options
148
141
  )
149
142
  end
150
143
 
@@ -155,7 +148,6 @@ module CanvasSync
155
148
  mapping[:group_memberships][:report_columns],
156
149
  GroupMembership,
157
150
  mapping[:group_memberships][:conflict_target].to_sym,
158
- import_args: @options
159
151
  )
160
152
  end
161
153
  end
@@ -8,16 +8,15 @@ module CanvasSync
8
8
  # @param options [Hash]
9
9
  class SubmissionsProcessor < ReportProcessor
10
10
  def self.process(report_file_path, _options, report_id)
11
- new(report_file_path, _options)
11
+ new(report_file_path)
12
12
  end
13
13
 
14
- def initialize(report_file_path, options)
14
+ def initialize(report_file_path)
15
15
  CanvasSync::Importers::BulkImporter.import(
16
16
  report_file_path,
17
17
  mapping[:submissions][:report_columns],
18
18
  Submission,
19
19
  mapping[:submissions][:conflict_target].to_sym,
20
- import_args: options
21
20
  )
22
21
  end
23
22
  end
@@ -1,3 +1,3 @@
1
1
  module CanvasSync
2
- VERSION = "0.16.5".freeze
2
+ VERSION = "0.17.0.beta1".freeze
3
3
  end