canvas_sync 0.18.0.beta1 → 0.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/canvas_sync/concerns/api_syncable.rb +5 -0
- data/lib/canvas_sync/concerns/auto_relations.rb +11 -0
- data/lib/canvas_sync/importers/bulk_importer.rb +18 -2
- data/lib/canvas_sync/record.rb +4 -0
- data/lib/canvas_sync/version.rb +1 -1
- data/lib/canvas_sync.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98a15ade4fa059c8a6641a20f560c32a81ff3ef066a46c7e79bd2182e25bed18
|
4
|
+
data.tar.gz: 9d08800f6bdc163b40e727ae97ebb7baf82abe47d585e252860c6e31cf812144
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d603c64d9ca24d974913f6c422c9a0f3f6a9eecb6486a0d6f8fc26a57bffaa1c40971ec56bd54adb1a187896307accc2e7910947db90bd79d3737d6d7d773c76
|
7
|
+
data.tar.gz: 5a8d948e840c39e1e47647d0f8c4dcd46057349abf9818ce9acb04879408c3ee37961fab8fa1391832f7f35d1e099eba1c627c211370316eda564fd65e1f5430
|
@@ -155,6 +155,11 @@ module CanvasSync::Concerns
|
|
155
155
|
end
|
156
156
|
|
157
157
|
apply_block = options[:process_response]
|
158
|
+
|
159
|
+
if self.class.column_names.include?("canvas_synced_at")
|
160
|
+
self.canvas_synced_at = mapped_params[:canvas_synced_at] = DateTime.now
|
161
|
+
end
|
162
|
+
|
158
163
|
if apply_block.present?
|
159
164
|
case apply_block.arity
|
160
165
|
when 1
|
@@ -101,7 +101,19 @@ module CanvasSync
|
|
101
101
|
|
102
102
|
options = { validate: false, on_duplicate_key_update: update_conditions }.merge(import_args)
|
103
103
|
options.delete(:on_duplicate_key_update) if options.key?(:on_duplicate_key_ignore)
|
104
|
-
|
104
|
+
|
105
|
+
result = klass.import(columns, rows, options)
|
106
|
+
|
107
|
+
global_updates = {
|
108
|
+
canvas_synced_at: DateTime.now,
|
109
|
+
canvas_sync_batch_id: JobBatches::Batch.current_context[:sync_batch_id],
|
110
|
+
}
|
111
|
+
global_updates.slice!(*klass.column_names.map(&:to_sym))
|
112
|
+
if global_updates.present? && result.ids.present?
|
113
|
+
klass.where(id: result.ids).update_all(global_updates)
|
114
|
+
end
|
115
|
+
|
116
|
+
result
|
105
117
|
end
|
106
118
|
|
107
119
|
# This method generates SQL that looks like:
|
@@ -118,9 +130,13 @@ module CanvasSync
|
|
118
130
|
columns_str = columns.map { |c| "#{klass.quoted_table_name}.#{c}" }.join(", ")
|
119
131
|
excluded_str = columns.map { |c| "EXCLUDED.#{c}" }.join(", ")
|
120
132
|
condition_sql = "(#{columns_str}) IS DISTINCT FROM (#{excluded_str})"
|
121
|
-
|
133
|
+
|
134
|
+
if klass.column_names.include?("canvas_synced_at") && report_start
|
135
|
+
condition_sql += " AND #{klass.quoted_table_name}.canvas_synced_at < '#{report_start}'"
|
136
|
+
elsif klass.column_names.include?("updated_at") && report_start
|
122
137
|
condition_sql += " AND #{klass.quoted_table_name}.updated_at < '#{report_start}'"
|
123
138
|
end
|
139
|
+
|
124
140
|
condition_sql
|
125
141
|
end
|
126
142
|
|
data/lib/canvas_sync/record.rb
CHANGED
@@ -100,6 +100,10 @@ module CanvasSync
|
|
100
100
|
|
101
101
|
included do
|
102
102
|
define_model_callbacks :sync_import
|
103
|
+
|
104
|
+
if column_names.include?("canvas_sync_batch_id")
|
105
|
+
belongs_to :canvas_sync_batch, foreign_key: :canvas_sync_batch_id, class_name: "CanvasSync::SyncBatch", optional: true
|
106
|
+
end
|
103
107
|
end
|
104
108
|
end
|
105
109
|
end
|
data/lib/canvas_sync/version.rb
CHANGED
data/lib/canvas_sync.rb
CHANGED
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.18.
|
4
|
+
version: 0.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nate Collings
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -414,6 +414,7 @@ files:
|
|
414
414
|
- lib/canvas_sync/concerns/ability_helper.rb
|
415
415
|
- lib/canvas_sync/concerns/account/ancestry.rb
|
416
416
|
- lib/canvas_sync/concerns/api_syncable.rb
|
417
|
+
- lib/canvas_sync/concerns/auto_relations.rb
|
417
418
|
- lib/canvas_sync/concerns/legacy_columns.rb
|
418
419
|
- lib/canvas_sync/concerns/role/base.rb
|
419
420
|
- lib/canvas_sync/concerns/sync_mapping.rb
|
@@ -744,9 +745,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
744
745
|
version: '0'
|
745
746
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
746
747
|
requirements:
|
747
|
-
- - "
|
748
|
+
- - ">="
|
748
749
|
- !ruby/object:Gem::Version
|
749
|
-
version:
|
750
|
+
version: '0'
|
750
751
|
requirements: []
|
751
752
|
rubygems_version: 3.1.6
|
752
753
|
signing_key:
|