ntq_excelsior 0.5.2 → 0.5.4
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/README.md +2 -0
- data/lib/ntq_excelsior/exporter.rb +4 -1
- data/lib/ntq_excelsior/importer.rb +9 -4
- data/lib/ntq_excelsior/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc8cbf2a89c838237dc9ab67a36e6c610b058ee4636ba2b7d8b1e6c782ffe989
|
4
|
+
data.tar.gz: d4ccb408477c98f9cb66cf7dea7e3ae255b1a69690090f58207c7786e9856647
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca1474e047e0785f7312a3275c8f4fda697c366b6efa156442eb253a9d8b7ead28d3d1997b35562f7300fa3a4cc506e2538a41b111470ba9424365c131775b9e
|
7
|
+
data.tar.gz: 2d45cdd5ad98112b37c94e0c60c1b07cdc92dd80a1d28ace095a958958d327d129a51b93fa8e7cfdb77e73a616d3ed5e656c6f1ebd408458025bacbcc7b675fc
|
data/README.md
CHANGED
@@ -53,7 +53,7 @@ module NtqExcelsior
|
|
53
53
|
letters << index % 26
|
54
54
|
|
55
55
|
while index >= 26 do
|
56
|
-
index = index / 26 - 1
|
56
|
+
index = (index / 26) - 1
|
57
57
|
letters << index % 26
|
58
58
|
end
|
59
59
|
|
@@ -131,6 +131,9 @@ module NtqExcelsior
|
|
131
131
|
accessors = accessors.split(".") if accessors.is_a?(String)
|
132
132
|
value = dig_value(record, accessors)
|
133
133
|
end
|
134
|
+
if value.is_a?(String)
|
135
|
+
type = :string
|
136
|
+
end
|
134
137
|
if value.is_a?(Date)
|
135
138
|
value = value.strftime("%Y-%m-%d")
|
136
139
|
styles << :date_format
|
@@ -144,6 +144,8 @@ module NtqExcelsior
|
|
144
144
|
|
145
145
|
def import_line(line, save: true)
|
146
146
|
record = find_or_initialize_record(line)
|
147
|
+
return { status: :not_found } unless record
|
148
|
+
|
147
149
|
@success = false
|
148
150
|
@action = nil
|
149
151
|
@errors = []
|
@@ -173,11 +175,14 @@ module NtqExcelsior
|
|
173
175
|
at = 0
|
174
176
|
errors_lines = []
|
175
177
|
success_count = 0
|
178
|
+
not_found_count = 0
|
176
179
|
lines.each_with_index do |line, index|
|
177
|
-
break if errors_lines.size == self.class.max_error_count
|
180
|
+
break if errors_lines.size == self.class.max_error_count
|
178
181
|
|
179
182
|
result = import_line(line.with_indifferent_access, save: true)
|
180
183
|
case result[:status]
|
184
|
+
when :not_found
|
185
|
+
not_found_count += 1
|
181
186
|
when :success
|
182
187
|
success_count += 1
|
183
188
|
when :error
|
@@ -188,12 +193,12 @@ module NtqExcelsior
|
|
188
193
|
|
189
194
|
if @status_tracker&.is_a?(Proc)
|
190
195
|
at = (((index + 1).to_d / lines.size) * 100.to_d)
|
191
|
-
@status_tracker.call(at)
|
196
|
+
@status_tracker.call(at)
|
192
197
|
end
|
193
198
|
end
|
194
199
|
|
195
|
-
{ success_count: success_count, errors: errors_lines }
|
200
|
+
{ success_count: success_count, not_found_count: not_found_count, errors: errors_lines }
|
196
201
|
end
|
197
202
|
|
198
203
|
end
|
199
|
-
end
|
204
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ntq_excelsior
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: caxlsx
|