tallty_import_export 1.0.30 → 1.0.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tallty_import_export/import.rb +10 -2
- data/lib/tallty_import_export/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fc8d251f5c43b1e6e7aaf423043ea169502a7333efef9812da5eb30569dcc9f
|
4
|
+
data.tar.gz: 0b207ea6ccd23e1fc154f80bec5a64683e2fb6aaa908bf48d24e0c979fdbba84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 974b43f19133ca3a956298134e93e30e8d0bead9095957d909cfcad91ed8b601855465c4d227b0bfa4bf5f9c88c006c0a6cb1bbc078b6fffb944a36808b9b252
|
7
|
+
data.tar.gz: 05deb4675a3ad28ee2f492ba89e61deebbe363229c7d24c5233a36f9c49852ed60debb10ef49790265e8b38607039b24d0e5e63e8fa2875d9f68048a2b370b1f
|
@@ -110,8 +110,16 @@ module TalltyImportExport
|
|
110
110
|
true
|
111
111
|
end
|
112
112
|
|
113
|
+
# 需要合并proc,前端没有办法把proc传过来
|
113
114
|
def import_headers_result
|
114
|
-
|
115
|
+
import_header_hash = import_headers.to_h { |header| [header.with_indifferent_access[:key], header] }.with_indifferent_access
|
116
|
+
@headers.map do |header|
|
117
|
+
key = header[:key]
|
118
|
+
if import_header_hash.fetch(key)&.fetch(:proc).present?
|
119
|
+
header[:proc] = import_header_hash.fetch(key)&.fetch(:proc)
|
120
|
+
end
|
121
|
+
header
|
122
|
+
end
|
115
123
|
end
|
116
124
|
|
117
125
|
def import_options
|
@@ -156,7 +164,7 @@ module TalltyImportExport
|
|
156
164
|
_record = associations.find_or_initialize_by(line_info.clone.extract!(*primary_keys))
|
157
165
|
_record.update!(line_info.clone.except!(*primary_keys, *@skip_keys))
|
158
166
|
else
|
159
|
-
associations.create!(line_info)
|
167
|
+
associations.create!(line_info.clone.except!(*@skip_keys))
|
160
168
|
end
|
161
169
|
end
|
162
170
|
end
|