imp_exp 1.1.2 → 1.2.1
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 +2 -3
- data/app/services/imp_exp/importers/xlsx.rb +2 -0
- data/app/services/imp_exp/models/base.rb +3 -1
- data/app/services/imp_exp/serializers/whole_records.rb +1 -1
- data/config/locales/en.yml +1 -0
- data/config/locales/fr.yml +1 -0
- data/lib/imp_exp/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: 5f28ed3841e2f2cef56566da34d4994ba911680f3524d5568cb0a2211dab2d0c
|
|
4
|
+
data.tar.gz: e7f954cf9859c05aabe70b21c0d8cb6db9623e96e0ba269bb348b39f0bc2905b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 96e48f2adb43f7eeb7a49d5a367c9eb4aeaf5f2ac0fd6eb377fd092521b0ce4bc1a7eac3d783236668297d6889508251cacb9684accbcdb24d8878667affcf62
|
|
7
|
+
data.tar.gz: 84bdf4afd2c4a37285347394523ac0354bfd791f21ed661727bc03737bc36601df9f3f14c6b58eda374fc7bf563e200b4a4548eb6e7c0f421d630d7a79b172da
|
|
@@ -82,8 +82,7 @@ module ImpExp
|
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
begin
|
|
85
|
-
if
|
|
86
|
-
model.after_save(record)
|
|
85
|
+
if model.save(record)
|
|
87
86
|
@imported[model.model_name] += 1
|
|
88
87
|
next
|
|
89
88
|
end
|
|
@@ -145,7 +144,7 @@ module ImpExp
|
|
|
145
144
|
|
|
146
145
|
full_file_path = File.join(files_directory_path, file_path.strip)
|
|
147
146
|
begin
|
|
148
|
-
file = File.open(full_file_path)
|
|
147
|
+
file = File.open(full_file_path) # rubocop:disable Style/FileOpen
|
|
149
148
|
record.send(file_attribute_name).attach(io: file, filename: File.basename(file_path))
|
|
150
149
|
rescue Errno::ENOENT
|
|
151
150
|
error_msg = I18n.t('imp_exp.importer.file_not_found', file_path: file_path)
|
|
@@ -143,7 +143,9 @@ module ImpExp
|
|
|
143
143
|
"#{active_storage_file.name}-#{active_storage_file.record.code}#{file_extension(active_storage_file)}"
|
|
144
144
|
end
|
|
145
145
|
|
|
146
|
-
def
|
|
146
|
+
def save(record)
|
|
147
|
+
record.save(context: :import)
|
|
148
|
+
end
|
|
147
149
|
|
|
148
150
|
private
|
|
149
151
|
|
|
@@ -26,7 +26,7 @@ module ImpExp
|
|
|
26
26
|
return [ImpExp::Serializers::Errors::WrongFormat.new("#{relation_name} error | #{message}")]
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
unless data.is_a?(Array) && data.all?
|
|
29
|
+
unless data.is_a?(Array) && data.all?(Hash)
|
|
30
30
|
return [ImpExp::Serializers::Errors::WrongFormat.new("#{relation_name} should be an array of hashes")]
|
|
31
31
|
end
|
|
32
32
|
|
data/config/locales/en.yml
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
en:
|
|
2
2
|
imp_exp:
|
|
3
3
|
importer:
|
|
4
|
+
duplicated_headers: "A duplicate header in a sheet of the import file prevents the file from being imported"
|
|
4
5
|
invalid_columns: "The %{model_name} sheet does not contain the expected columns. Expected columns: %{expected_columns} Columns in the file: %{in_file_columns}."
|
|
5
6
|
invalid_sheets: "The file does not contain the expected sheets. Expected sheets: %{expected_sheets} Sheets in the file: %{in_file_sheets}."
|
|
6
7
|
record_not_found: "%{model_name} with %{conditions} conditions has not been found."
|
data/config/locales/fr.yml
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
fr:
|
|
2
2
|
imp_exp:
|
|
3
3
|
importer:
|
|
4
|
+
duplicated_headers: "Un doublon d'en-tête de colonne dans une feuille du fichier d'import empêche l'import de fonctionner."
|
|
4
5
|
invalid_columns: "La feuille %{model_name} ne contient pas les colonnes attendues. Colonnes attendues : %{expected_columns}. Colonnes dans le fichier : %{in_file_columns}."
|
|
5
6
|
invalid_sheets: "Le fichier ne contient pas les feuilles attendues. Feuilles attendues : %{expected_sheets}. Feuilles dans le fichier : %{in_file_sheets}."
|
|
6
7
|
record_not_found: "%{model_name} avec les conditions %{conditions} n'a pas été trouvé."
|
data/lib/imp_exp/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: imp_exp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1
|
|
4
|
+
version: 1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dev team Nerya
|
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
139
139
|
- !ruby/object:Gem::Version
|
|
140
140
|
version: '0'
|
|
141
141
|
requirements: []
|
|
142
|
-
rubygems_version: 4.0.
|
|
142
|
+
rubygems_version: 4.0.10
|
|
143
143
|
specification_version: 4
|
|
144
144
|
summary: Import data from xlsx into a rails app and export data to xlsx from a rails
|
|
145
145
|
app
|