canvas_sync 0.18.0.beta1 → 0.18.0.beta2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8e85a06016546795344ff896342c54b8c3ec40dbd0568473bd0e4dc899c17d3
|
4
|
+
data.tar.gz: d2b566f00eb432b73fb8f47d70d1a88233c461ada010c374f677fcb2cde1a0aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd4fdb11e3a79d796d18b908e100130ffaf503d060e00a5a8fb0cd249c70c3cbb5caf4fbf734ebf77c732c9640c361af5577df9c41431a9dc3ab3f7689852243
|
7
|
+
data.tar.gz: 63e5afb3933e8659cb3e263f2ace1ee6cdd2f344da9e439c9b44ac3f32c45c92935ce4c6f12d3966c7a2547b09a8bad8481c1706ebb34df7e0414bbe56a33fe1
|
@@ -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
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.0.
|
4
|
+
version: 0.18.0.beta2
|
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-03-
|
11
|
+
date: 2023-03-29 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
|