canvas_sync 0.17.18 → 0.17.19
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: d995ce469310b7b54158745305c968edd4c7a910bcad87891ffabfa29cd22a30
|
4
|
+
data.tar.gz: 83a0bb75ceb290402137f2531e1925d4872a0e272fcabf75a6c3451b3de5f721
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9287196092064977d34259de638cfd41cf189f6dc9b6a97c6fd507d2555f8f3b0527643d38991765d56bf428856407608ef0c1834b48b6a6dd3201ed232b9879
|
7
|
+
data.tar.gz: a751ad1e08d3feb2716e41d4c552f983f2d83590321dc4d1cc2a18d2f800859587fa1884272bbdbaff0cc4aefe867c0af8f0dfb24c2dc6aba25190e7a190449a
|
@@ -26,7 +26,11 @@ module CanvasSync
|
|
26
26
|
def self.perform_in_batches(report_file_path, mapping, klass, conflict_target, import_args: {})
|
27
27
|
csv_column_names = mapping.keys
|
28
28
|
database_column_names = mapping.values.map { |value| value[:database_column_name] }
|
29
|
-
|
29
|
+
|
30
|
+
puts mapping.inspect
|
31
|
+
|
32
|
+
conflict_target = Array(conflict_target).map(&:to_sym)
|
33
|
+
database_conflict_column_name = conflict_target.map{|ct| mapping[ct][:database_column_name] }
|
30
34
|
|
31
35
|
row_ids = {}
|
32
36
|
batcher = CanvasSync::BatchProcessor.new(of: batch_size) do |batch|
|
@@ -35,9 +39,11 @@ module CanvasSync
|
|
35
39
|
end
|
36
40
|
|
37
41
|
row_buffer_out = ->(row) {
|
38
|
-
if conflict_target
|
39
|
-
|
40
|
-
row_ids[
|
42
|
+
if conflict_target.present?
|
43
|
+
key = conflict_target.map{|ct| row[ct] }
|
44
|
+
next if row_ids[key]
|
45
|
+
|
46
|
+
row_ids[key] = true
|
41
47
|
end
|
42
48
|
|
43
49
|
formatted_row = csv_column_names.map do |column|
|
@@ -79,7 +85,7 @@ module CanvasSync
|
|
79
85
|
condition: condition_sql(klass, columns, import_args[:sync_start_time]),
|
80
86
|
columns: columns
|
81
87
|
}
|
82
|
-
update_conditions[:conflict_target] = conflict_target if conflict_target
|
88
|
+
update_conditions[:conflict_target] = conflict_target if conflict_target.present?
|
83
89
|
|
84
90
|
options = { validate: false, on_duplicate_key_update: update_conditions }.merge(import_args)
|
85
91
|
options.delete(:on_duplicate_key_update) if options.key?(:on_duplicate_key_ignore)
|
@@ -46,7 +46,7 @@ module CanvasSync
|
|
46
46
|
m = Regexp.last_match
|
47
47
|
day = m[1]
|
48
48
|
skip = m[2] || "1"
|
49
|
-
|
49
|
+
DateTime.now.send(:"#{day}?") && last_full_sync.end_of_day <= (skip.to_i.weeks.ago.end_of_day)
|
50
50
|
when opt.match?(%r{^(\d+)\%$})
|
51
51
|
m = Regexp.last_match
|
52
52
|
rand(100) < m[1].to_i
|
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.17.
|
4
|
+
version: 0.17.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nate Collings
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|