canvas_sync 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bff01b4de68a53faba86076d5390dd4c95d1feec6be899cc28a21ccf2c80a918
4
- data.tar.gz: c676786d55e600ed58167c00290cd29e119b62b1bf7974c7ff4df46697759223
3
+ metadata.gz: 7795e4388557d88e9134d2c5ae6dee8770ba282f1dd72a10686aaa7974741c92
4
+ data.tar.gz: db4251351aabda748429adb17bdcb3c3dbc383d0dc2a7a112c324d0e8e273067
5
5
  SHA512:
6
- metadata.gz: c7340c9158ecc077e4f2246c24c6b4a608229cc2568a74b25b2afe8d7bebfd42e79deb23b49d22a7d7842e9a7923caaa1a43843fc68fa04497901477d480e9a2
7
- data.tar.gz: a4f9ca68735ccc0ceb42cc9f8b486dd18b02e508b7ece0242b1a56c49c33db7e426126f0cb3d7a5bd5ba1057ee69082fe66ecfad252cab0fcb5d16c9c3fc12f4
6
+ metadata.gz: 3babc49ea2a583a81560aed52f08dcf7c4a706b74123fb1128b04f77030c575c3764feda1f5aab33c0e009b5c7d959cd2ebd7cdd79f566d9fdbad1f7a57d204d
7
+ data.tar.gz: '0048f0ebb889753af134a28a592a7b1ebee8f6b5c4d67c9ed816271fc4a14356a62ff8643b9bdfaf9a3e04046a95035768248790d56366b0db6f6a58701c2d4f'
@@ -12,6 +12,7 @@ class CreateCourses < ActiveRecord::Migration[5.1]
12
12
  t.integer :canvas_term_id
13
13
  t.datetime :start_at
14
14
  t.datetime :end_at
15
+ t.bigint :grading_standard_id
15
16
 
16
17
  t.timestamps
17
18
  end
@@ -58,12 +58,13 @@ module CanvasSync
58
58
  columns = columns.dup
59
59
 
60
60
  update_conditions = {
61
- condition: condition_sql(klass, columns, import_args[:sync_start_time]),
61
+ condition: condition_sql(klass, columns),
62
62
  columns: columns
63
63
  }
64
64
  update_conditions[:conflict_target] = conflict_target if conflict_target
65
65
 
66
66
  options = { validate: false, on_duplicate_key_update: update_conditions }.merge(import_args)
67
+
67
68
  options.delete(:on_duplicate_key_update) if options.key?(:on_duplicate_key_ignore)
68
69
  klass.import(columns, rows, options)
69
70
  end
@@ -78,14 +79,10 @@ module CanvasSync
78
79
  # started_at = Time.now
79
80
  # run_the_users_sync!
80
81
  # changed = User.where("updated_at >= ?", started_at)
81
- def self.condition_sql(klass, columns, report_start)
82
+ def self.condition_sql(klass, columns)
82
83
  columns_str = columns.map { |c| "#{klass.quoted_table_name}.#{c}" }.join(", ")
83
84
  excluded_str = columns.map { |c| "EXCLUDED.#{c}" }.join(", ")
84
- condition_sql = "(#{columns_str}) IS DISTINCT FROM (#{excluded_str})"
85
- if klass.column_names.include?("updated_at") && report_start
86
- condition_sql += " AND #{klass.quoted_table_name}.updated_at < '#{report_start}'"
87
- end
88
- condition_sql
85
+ "(#{columns_str}) IS DISTINCT FROM (#{excluded_str})"
89
86
  end
90
87
 
91
88
  def self.batch_size
@@ -12,7 +12,7 @@ module CanvasSync
12
12
  # @return [nil]
13
13
  def perform(job_chain, report_name, report_params, processor, options, allow_redownloads: false)
14
14
  account_id = options[:account_id] || job_chain[:global_options][:account_id] || "self"
15
- options[:sync_start_time] = DateTime.now.utc.iso8601
15
+
16
16
  report_id = if allow_redownloads
17
17
  get_cached_report(job_chain, account_id, report_name, report_params)
18
18
  else
@@ -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
@@ -81,6 +81,9 @@ courses:
81
81
  status:
82
82
  database_column_name: workflow_state
83
83
  type: integer
84
+ grading_standard_id:
85
+ database_column_name: grading_standard_id
86
+ type: integer
84
87
 
85
88
  enrollments:
86
89
  conflict_target: canvas_enrollment_id
@@ -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
 
@@ -83,8 +83,7 @@ module CanvasSync
83
83
  report_file_path,
84
84
  mapping[:accounts][:report_columns],
85
85
  Account,
86
- mapping[:accounts][:conflict_target].to_sym,
87
- import_args: @options
86
+ mapping[:accounts][:conflict_target].to_sym
88
87
  )
89
88
  end
90
89
 
@@ -94,7 +93,6 @@ module CanvasSync
94
93
  mapping[:courses][:report_columns],
95
94
  Course,
96
95
  mapping[:courses][:conflict_target].to_sym,
97
- import_args: @options
98
96
  )
99
97
  end
100
98
 
@@ -104,7 +102,6 @@ module CanvasSync
104
102
  mapping[:enrollments][:report_columns],
105
103
  Enrollment,
106
104
  mapping[:enrollments][:conflict_target].to_sym,
107
- import_args: @options
108
105
  )
109
106
  end
110
107
 
@@ -114,7 +111,6 @@ module CanvasSync
114
111
  mapping[:sections][:report_columns],
115
112
  Section,
116
113
  mapping[:sections][:conflict_target].to_sym,
117
- import_args: @options
118
114
  )
119
115
  end
120
116
 
@@ -124,7 +120,6 @@ module CanvasSync
124
120
  mapping[:xlist][:report_columns],
125
121
  Section,
126
122
  mapping[:xlist][:conflict_target].to_sym,
127
- import_args: @options
128
123
  )
129
124
  end
130
125
  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.11.1".freeze
2
+ VERSION = "0.12.0".freeze
3
3
  end
@@ -18,6 +18,7 @@ class CreateCourses < ActiveRecord::Migration[5.1]
18
18
  t.integer :canvas_term_id
19
19
  t.datetime :start_at
20
20
  t.datetime :end_at
21
+ t.bigint :grading_standard_id
21
22
 
22
23
  t.timestamps
23
24
  end
@@ -138,6 +138,7 @@ ActiveRecord::Schema.define(version: 20190927204546) do
138
138
  t.integer "canvas_term_id"
139
139
  t.datetime "start_at"
140
140
  t.datetime "end_at"
141
+ t.bigint "grading_standard_id"
141
142
  t.datetime "created_at", null: false
142
143
  t.datetime "updated_at", null: false
143
144
  t.index ["canvas_id"], name: "index_courses_on_canvas_id", unique: true
@@ -1,3 +1,3 @@
1
1
  canvas_course_id,course_id,integration_id,short_name,long_name,canvas_account_id,account_id,canvas_term_id,term_id,status,start_date,end_date,course_format,created_by_sis
2
2
  1,course_sis_id_1,,C1,Course #1,1,,1,term_sis_id_1,active,2017-03-27T15:53:18-06:00,2017-04-27T06:21:18-06:00,,FALSE
3
- 2,course_sis_id_2,,C2,Course #2,1,,1,term_sis_id_2,unpublished,2017-03-27T15:53:18-06:00,2017-04-27T06:21:18-06:00,,FALSE
3
+ 2,course_sis_id_2,,C2,Course #2,1,,1,term_sis_id_2,unpublished,2017-03-27T15:53:18-06:00,2017-04-27T06:21:18-06:00,,FALSE,5
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canvas_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Collings
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-27 00:00:00.000000000 Z
11
+ date: 2020-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -268,14 +268,14 @@ dependencies:
268
268
  requirements:
269
269
  - - ">="
270
270
  - !ruby/object:Gem::Version
271
- version: 1.3.22
271
+ version: 1.3.49
272
272
  type: :runtime
273
273
  prerelease: false
274
274
  version_requirements: !ruby/object:Gem::Requirement
275
275
  requirements:
276
276
  - - ">="
277
277
  - !ruby/object:Gem::Version
278
- version: 1.3.22
278
+ version: 1.3.49
279
279
  - !ruby/object:Gem::Dependency
280
280
  name: activerecord-import
281
281
  requirement: !ruby/object:Gem::Requirement
@@ -304,7 +304,7 @@ dependencies:
304
304
  - - ">="
305
305
  - !ruby/object:Gem::Version
306
306
  version: '0'
307
- description:
307
+ description:
308
308
  email:
309
309
  - ncollings@instructure.com
310
310
  executables: []
@@ -543,7 +543,7 @@ files:
543
543
  homepage: https://instructure.com
544
544
  licenses: []
545
545
  metadata: {}
546
- post_install_message:
546
+ post_install_message:
547
547
  rdoc_options: []
548
548
  require_paths:
549
549
  - lib
@@ -558,8 +558,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
558
558
  - !ruby/object:Gem::Version
559
559
  version: '0'
560
560
  requirements: []
561
- rubygems_version: 3.1.2
562
- signing_key:
561
+ rubygems_version: 3.0.3
562
+ signing_key:
563
563
  specification_version: 4
564
564
  summary: Gem for generating Canvas models and migrations and syncing data from Canvas
565
565
  test_files: