importo 3.0.15 → 3.0.16

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: 129f39dcc8d61a3eb8f38629fbcd97d176c645cff64ffbef92ec56344a3d3e63
4
- data.tar.gz: 4ed23b370e993fd94d5a364d1dfa8632a4dcc2cfd875db1c4d00f8ec31058523
3
+ metadata.gz: 67757044a87ce6eda6eceddd937b93404eda3cc979298f2d22316ea6db0e6eb1
4
+ data.tar.gz: 603c9602c07ac03a0fab0ed20f9dc81fec5df0bfb153f758add2d05f29bd418e
5
5
  SHA512:
6
- metadata.gz: c8e202ba1d1d0c12d60b33bf13c2a3ecab28e039d5864cbf5c4b451a0addd0d86aa10a8db6010570414dc6007ec642cccdaee1314ba773225d30f00f41c4d9a7
7
- data.tar.gz: a9ef9e5b42b6c11218717a4c2b213409be6e102bf543771f7472710dfc14c4a54f5285edea56256faec0afa5041455e4f083ae566c26934c7bca59e339393b06
6
+ metadata.gz: '070083420acdf0dd06ab2b59c1595e4e76906b8594944ac00c091baf82c9465efd56c8a90b270d368d7f2571322ee6ec5134195f3e83f4b1764bb97880ad9015'
7
+ data.tar.gz: 744f9d63c5d552c673ab7bb4e83a147605e8c1558e60e3545a95e298cac6683114e96385d74794db6ac1fff02ab4e963d214c3f2a720f77e9653c6a1c8d2233c
@@ -8,7 +8,7 @@ module Importo
8
8
  @instance = Sidekiq::Batch.new
9
9
  end
10
10
 
11
- delegate :description=, to: :@instance
11
+ delegate :description=, :bid, to: :@instance
12
12
 
13
13
  def on_success(job)
14
14
  @instance.on(:success, job.constantize, properties)
@@ -132,6 +132,7 @@ module Importable
132
132
  batch.on_success("Importo::ImportJobCallback")
133
133
 
134
134
  batch.add do
135
+ bid = batch.bid
135
136
  column_with_delay = columns.select { |k, v| v.delay.present? }
136
137
  loop_data_rows do |attributes, index|
137
138
  if column_with_delay.present?
@@ -140,8 +141,8 @@ module Importable
140
141
  v.delay.call(attributes[k])
141
142
  end.compact
142
143
  end
143
- Importo::ImportJob.set(wait_until: (delay.max * index).seconds.from_now).perform_async(JSON.dump(attributes), index, import.id) if delay.present?
144
- Importo::ImportJob.perform_async(JSON.dump(attributes), index, import.id) unless delay.present?
144
+ Importo::ImportJob.set(wait_until: (delay.max * index).seconds.from_now).perform_async(JSON.dump(attributes), index, import.id, bid) if delay.present?
145
+ Importo::ImportJob.perform_async(JSON.dump(attributes), index, import.id, bid) unless delay.present?
145
146
  end
146
147
  end
147
148
 
@@ -2,7 +2,7 @@ module Importo
2
2
  class ImportJobCallback
3
3
  include Rails.application.routes.url_helpers
4
4
 
5
- def on_complete(options)
5
+ def on_success(_status, options)
6
6
  options = options.deep_stringify_keys
7
7
  import = Import.find(options["import_id"])
8
8
  if import.present?
@@ -20,7 +20,7 @@ module Importo
20
20
  end
21
21
  end
22
22
 
23
- def perform(attributes, index, import_id)
23
+ def perform(attributes, index, import_id, bid)
24
24
  self.class.execute_row(attributes, index, import_id, false, bid)
25
25
  end
26
26
 
@@ -33,7 +33,7 @@ module Importo
33
33
  batch = Importo::SidekiqBatchAdapter.find(bid)
34
34
 
35
35
  if !import.completed? && import.can_complete? && batch.finished?
36
- ImportJobCallback.new.on_complete(import_id: import_id)
36
+ ImportJobCallback.new.on_success(batch.status, {import_id: import_id})
37
37
  end
38
38
  end
39
39
  end
@@ -30,7 +30,7 @@ module Importo
30
30
  import.save!
31
31
 
32
32
  ImportService.perform(import: import)
33
- ImportJobCallback.new.on_complete({import_id: import.id})
33
+ ImportJobCallback.new.on_success({import_id: import.id})
34
34
  import
35
35
  end
36
36
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Importo
4
- VERSION = "3.0.15"
4
+ VERSION = "3.0.16"
5
5
  end
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.15
4
+ version: 3.0.16
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: 2024-09-18 00:00:00.000000000 Z
12
+ date: 2024-09-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: caxlsx