imp_exp 1.0.5 → 1.0.7
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 +4 -4
- data/app/services/imp_exp/importers/base.rb +13 -2
- data/app/services/imp_exp/models/base.rb +4 -0
- data/lib/imp_exp/version.rb +1 -1
- metadata +19 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f795bb8e12db3914363f65aa3cb931d9d6bc210688b65eef052acab274060481
|
4
|
+
data.tar.gz: b3d8391a78c691492c405dcc72c3c75b4231cdf727c5125f984a8a13bc951553
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4168507d5656a360c6607484172a0f226b651dfd72e5c568ca765d5fe21e813897832153903ebf75167f39708f5790c3df3c822c3e11a1b53639156ae056b91b
|
7
|
+
data.tar.gz: 0ca2f92ec2fd8e378efd7ddafb7049b3b49206cf985a34f5bd6af6ef5c43701cae9d21126e4012bc8c0e307633561195175913471ea9f939ec3efeb9943cf58e
|
@@ -7,7 +7,7 @@ module ImpExp
|
|
7
7
|
class Base
|
8
8
|
include Observable
|
9
9
|
|
10
|
-
attr_reader :scoping_parent, :models, :logger, :exception_notifier, :errors, :imported
|
10
|
+
attr_reader :scoping_parent, :models, :logger, :exception_notifier, :errors, :imported, :skipped
|
11
11
|
|
12
12
|
ROW_OFFSET = 2
|
13
13
|
|
@@ -21,6 +21,7 @@ module ImpExp
|
|
21
21
|
def call(data, files_directory_path = nil)
|
22
22
|
@errors = []
|
23
23
|
@imported = data.keys.map(&:model_name).index_with { 0 }
|
24
|
+
@skipped = data.keys.map(&:model_name).index_with { 0 }
|
24
25
|
logger.info "Starting import #{self.class.name} for #{scoping_parent.model_name.singular} " \
|
25
26
|
"#{scoping_parent.name} (#{scoping_parent.id})"
|
26
27
|
begin
|
@@ -47,7 +48,7 @@ module ImpExp
|
|
47
48
|
end
|
48
49
|
|
49
50
|
def import_result
|
50
|
-
{ imported: imported, import_errors: errors }
|
51
|
+
{ imported: imported, skipped: skipped, import_errors: errors }
|
51
52
|
end
|
52
53
|
|
53
54
|
def import_model_data(model, model_data, files_directory_path) # rubocop:disable Metrics/MethodLength
|
@@ -65,6 +66,11 @@ module ImpExp
|
|
65
66
|
|
66
67
|
record = find_or_initialize_record(row.merge(relation_attributes), scoping_parent, model)
|
67
68
|
|
69
|
+
if model.skip_record?(record)
|
70
|
+
@skipped[model.model_name] += 1
|
71
|
+
next
|
72
|
+
end
|
73
|
+
|
68
74
|
upsert_no_record_error(row, model, line) && next unless record
|
69
75
|
|
70
76
|
assign_attributes(record, attrs, model_name, line, row)
|
@@ -75,6 +81,11 @@ module ImpExp
|
|
75
81
|
|
76
82
|
attach_files(record, files_directory_path, model, row, line) if files_directory_path.present?
|
77
83
|
|
84
|
+
if model.skip_record?(record)
|
85
|
+
@skipped[model.model_name] += 1
|
86
|
+
next
|
87
|
+
end
|
88
|
+
|
78
89
|
if record.save(context: :import)
|
79
90
|
model.after_save(record)
|
80
91
|
@imported[model.model_name] += 1
|
data/lib/imp_exp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imp_exp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dev team Nerya
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-05-14 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: caxlsx
|
@@ -24,6 +23,20 @@ dependencies:
|
|
24
23
|
- - "~>"
|
25
24
|
- !ruby/object:Gem::Version
|
26
25
|
version: '3.4'
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: observer
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
27
40
|
- !ruby/object:Gem::Dependency
|
28
41
|
name: rails
|
29
42
|
requirement: !ruby/object:Gem::Requirement
|
@@ -33,7 +46,7 @@ dependencies:
|
|
33
46
|
version: 7.0.0
|
34
47
|
- - "<"
|
35
48
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
49
|
+
version: 8.0.0
|
37
50
|
type: :runtime
|
38
51
|
prerelease: false
|
39
52
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +56,7 @@ dependencies:
|
|
43
56
|
version: 7.0.0
|
44
57
|
- - "<"
|
45
58
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
59
|
+
version: 8.0.0
|
47
60
|
- !ruby/object:Gem::Dependency
|
48
61
|
name: rubyzip
|
49
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,11 +122,9 @@ files:
|
|
109
122
|
- lib/imp_exp.rb
|
110
123
|
- lib/imp_exp/version.rb
|
111
124
|
- lib/tasks/imp_exp.rake
|
112
|
-
homepage:
|
113
125
|
licenses:
|
114
126
|
- MIT
|
115
127
|
metadata: {}
|
116
|
-
post_install_message:
|
117
128
|
rdoc_options: []
|
118
129
|
require_paths:
|
119
130
|
- lib
|
@@ -128,8 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
139
|
- !ruby/object:Gem::Version
|
129
140
|
version: '0'
|
130
141
|
requirements: []
|
131
|
-
rubygems_version: 3.
|
132
|
-
signing_key:
|
142
|
+
rubygems_version: 3.6.2
|
133
143
|
specification_version: 4
|
134
144
|
summary: Import data from xlsx into a rails app and export data to xlsx from a rails
|
135
145
|
app
|