ntq_excelsior_engine 1.1.1 → 1.1.3

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: d28f21aa45d1b2035362612ad1572ca0984b10ce5bc012924920e5077823b241
4
- data.tar.gz: 41c467fbd6d7244b010f66626b97c1daeba987a507232c58a8cd322808a3b90f
3
+ metadata.gz: 7a203d257161eea84e4a05f2623d61e809f023a79049f344845d743a1bb67e95
4
+ data.tar.gz: c3851c059bb40ad5df9264046f85f35712494f0e9e1cb1bc107d8e6332eac615
5
5
  SHA512:
6
- metadata.gz: 010fd01a27833b9e57333e14bbeb6745b39d04767a8c2adec6252ba233fcc4bc469c3daebdb9508f67d84b96d2c9d35a59579f56a6288372ff7701790c91ea0f
7
- data.tar.gz: bbada930be6304b4c547c0d0f4012427d72249c0a1131a352a1f51c8918bfa2ed615806e33128a1b0023dbb190739a03c6ef033625f8c460534c27cff672d44b
6
+ metadata.gz: cd5d786244808e8735aaac4448de39ce94e6665bc0daa34c94f186e8aca23c4465d28d59f95c3d26fef957ea10d232f2492488d947307d36a954464ad92b8fbc
7
+ data.tar.gz: 91d2b191e61b7d6f6b986abfd053c575e1eaec7e996c7cdfc78b2bc3cc3a6b3346c0877a6fab67be55f2daee1c30abe5816a609793ec6140fcb7bd01ee767f98
@@ -1,4 +1,11 @@
1
1
  module NtqExcelsiorEngine
2
2
  class ApplicationController < ::ApplicationController
3
+ before_action :store_request
4
+
5
+ def store_request
6
+ return unless current_user
7
+
8
+ NtqExcelsiorEngine::Request.store[:whoimportit] = current_user
9
+ end
3
10
  end
4
11
  end
@@ -29,10 +29,9 @@ module NtqExcelsiorEngine
29
29
  render :status, layout: false
30
30
  end
31
31
 
32
-
33
32
  def create
34
33
  @import_file = ::NtqExcelsiorEngine::Import.new import_type: params[:type]
35
- @import_file.created_by = NtqExcelsiorEngine.request.whoimportit
34
+ @import_file.created_by = NtqExcelsiorEngine.request.whoimportit.id if NtqExcelsiorEngine.request.whoimportit
36
35
  @import_file.file = file_params
37
36
  yield(@import_file) if block_given?
38
37
  @import_file.inspect
@@ -56,9 +55,9 @@ module NtqExcelsiorEngine
56
55
  end
57
56
  render :status, layout: false
58
57
  end
59
-
58
+
60
59
  private
61
-
60
+
62
61
  def ensure_valid_importer_type!
63
62
  valid_types = NtqExcelsiorEngine.importers.keys.map(&:to_s)
64
63
  return render json: {}, status: 422 unless valid_types.include?(params[:type]) || params[:type].blank?
@@ -11,6 +11,11 @@ module NtqExcelsiorEngine
11
11
  def call
12
12
  import = context.import
13
13
  importer = context.importer.new
14
+ importer.options ||= {}
15
+ importer.options.merge!({
16
+ import_id: import.id,
17
+ creator: import.created_by
18
+ })
14
19
  begin
15
20
  import.update(state: 'importing')
16
21
  importer.class.before.call(importer.context, importer.options) if importer.class.before.is_a?(Proc)
@@ -7,7 +7,6 @@ module NtqExcelsiorEngine
7
7
  end
8
8
 
9
9
  def call
10
- sleep NtqExcelsiorEngine.delay_before_import if NtqExcelsiorEngine.delay_before_import > 0
11
10
  import = context.import
12
11
  importer = context.importer.new
13
12
  begin
@@ -2,7 +2,7 @@ module NtqExcelsiorEngine
2
2
  class ProcessImportJob
3
3
  include Sidekiq::Worker
4
4
  include Sidekiq::Status::Worker
5
-
5
+
6
6
  sidekiq_options queue: 'default', retry: 0
7
7
 
8
8
  def perform(id, actions = NtqExcelsiorEngine.actions_on_create.map(&:to_s).join(','))
@@ -1,3 +1,3 @@
1
1
  module NtqExcelsiorEngine
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ntq_excelsior_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-04 00:00:00.000000000 Z
11
+ date: 2024-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails