importo 3.0.27 → 3.0.28
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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 013fc113e0d5a9cd16cd888462a9d5437ee21d329cbe680ed5a905b6fd53dd23
|
|
4
|
+
data.tar.gz: 2d7b1fadf7a61b4527d02bfc3a206096f0acaa413b26a3cf61ebb43f15a45ef5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 967c9f7fc07adadaab9707cd6e6b87098a9672026871992b86d985d73e270bb5269cbd2ae244e0c30e85d89f8bbae4e28bc469e07c8bf3013f0820d8a11f6060
|
|
7
|
+
data.tar.gz: 2c6f5a588b252208692070db52fb65e3a5aa74a42040f9e30acdb8d085725672db888e143b76e28a02ba7b3de3ba8f1b20c33c45af15a52c4b4ea15884ac62a0
|
|
@@ -10,23 +10,29 @@ module Importo
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def complete_import(import)
|
|
13
|
-
if import.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
13
|
+
return if import.blank?
|
|
14
|
+
|
|
15
|
+
# Sidekiq's batch :complete event can fire as soon as every row has been
|
|
16
|
+
# attempted once, even though some rows failed and are still awaiting a
|
|
17
|
+
# retry. Bail out here so we don't finalize (and report a wrong count)
|
|
18
|
+
# before every row has actually finished processing.
|
|
19
|
+
return unless import.results.count == import.importer.send(:row_count)
|
|
20
|
+
|
|
21
|
+
results_file = import.importer.results_file
|
|
22
|
+
results_file = results_file.is_a?(StringIO) ? results_file : File.open(results_file)
|
|
23
|
+
|
|
24
|
+
import.result.attach(io: results_file, filename: import.importer.file_name("results"),
|
|
25
|
+
content_type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
|
26
|
+
|
|
27
|
+
ActiveRecord::Base.uncached do
|
|
28
|
+
import.result_message = I18n.t("importo.importers.result_message",
|
|
29
|
+
nr: import.results.where("details @> ?", {state: "success"}.to_json).count, of: import.importer.send(:row_count))
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
if import.can_complete?
|
|
33
|
+
import.complete!
|
|
34
|
+
else
|
|
35
|
+
import.save!
|
|
30
36
|
end
|
|
31
37
|
end
|
|
32
38
|
|
|
@@ -36,5 +42,9 @@ module Importo
|
|
|
36
42
|
import = Import.find(options["import_id"])
|
|
37
43
|
complete_import(import)
|
|
38
44
|
end
|
|
45
|
+
|
|
46
|
+
# Sidekiq's batch :success event only fires once every job (including
|
|
47
|
+
# retries) has truly succeeded, so it is the reliable place to finalize.
|
|
48
|
+
alias_method :on_success, :on_complete
|
|
39
49
|
end
|
|
40
50
|
end
|
|
@@ -21,7 +21,12 @@ module Importo
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def on_success(job)
|
|
24
|
+
# Register for both events: :complete can fire prematurely while rows are
|
|
25
|
+
# still awaiting a Sidekiq retry, :success only fires once every row has
|
|
26
|
+
# truly succeeded. ImportJobCallback itself guards against finalizing
|
|
27
|
+
# before every row has actually finished processing.
|
|
24
28
|
@instance.on(:complete, job.constantize, properties)
|
|
29
|
+
@instance.on(:success, job.constantize, properties)
|
|
25
30
|
end
|
|
26
31
|
|
|
27
32
|
def add
|
data/lib/importo/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: importo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.28
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andre Meij
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-08-
|
|
12
|
+
date: 2026-08-27 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: caxlsx
|