zizia 4.4.1.alpha.01 → 4.5.1.alpha.01
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/importers/modular_importer.rb +14 -11
- data/app/views/zizia/csv_import_details/index.html.erb +6 -2
- data/app/views/zizia/csv_import_details/show.html.erb +2 -3
- data/lib/zizia/version.rb +1 -1
- data/spec/dummy/spec/system/csv_import_details_page_spec.rb +1 -1
- data/spec/dummy/spec/system/import_from_csv_spec.rb +2 -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: be8096fc629accb26c9372a1d504a26e27ea0f8bd45b91ef19d35c45b747e566
|
4
|
+
data.tar.gz: b16397d6834829c155ba18f3f66850bb4f67a382579f7f7e34d2c1890a755e2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ddd55ffcb647acc0c356decbcf1de863c8110e40e54454a2d7a34325c8700a92d0cca75ea638589fdff43352895939d9a71385e9fe49de8c2b0ad8d275b81aa
|
7
|
+
data.tar.gz: 9b6124b66ffe83170c5413748245981510369f4ac7b75eab95a3e7612068a434d0b2273c589be63e3ee4c1f87e3993e8a368f707ca143e0b8c04b7e023fafd92
|
@@ -25,7 +25,7 @@ class ModularImporter
|
|
25
25
|
csv_import_detail.batch_id = @csv_import.id
|
26
26
|
csv_import_detail.deduplication_field = DEDUPLICATION_FIELD
|
27
27
|
csv_import_detail.update_actor_stack = @csv_import.update_actor_stack
|
28
|
-
csv_import_detail.save
|
28
|
+
csv_import_detail.save
|
29
29
|
|
30
30
|
attrs = {
|
31
31
|
csv_import_detail: csv_import_detail
|
@@ -34,18 +34,21 @@ class ModularImporter
|
|
34
34
|
Rails.logger.info "[zizia] event: start_import, batch_id: #{@csv_import.id}, collection_id: #{@collection_id}, user: #{@user_email}"
|
35
35
|
importer = Zizia::Importer.new(parser: Zizia::CsvParser.new(file: file), record_importer: Zizia::HyraxRecordImporter.new(attributes: attrs))
|
36
36
|
|
37
|
-
importer.records.
|
37
|
+
importer.records.each_with_index do |record, index|
|
38
38
|
pre_ingest_work = Zizia::PreIngestWork.new(csv_import_detail_id: csv_import_detail.id)
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
39
|
+
|
40
|
+
record.mapper.files.each do |child_file|
|
41
|
+
full_path = Dir.glob("#{ENV['IMPORT_PATH']}/**/#{child_file}").first
|
42
|
+
pre_ingest_file = Zizia::PreIngestFile.new(row_number: index + 1,
|
43
|
+
pre_ingest_work: pre_ingest_work,
|
44
|
+
filename: child_file,
|
45
|
+
size: File.size(full_path))
|
46
|
+
pre_ingest_file.save
|
47
|
+
end
|
48
|
+
pre_ingest_work.save
|
47
49
|
end
|
48
|
-
|
50
|
+
|
51
|
+
csv_import_detail.save
|
49
52
|
importer.import
|
50
53
|
file.close
|
51
54
|
end
|
@@ -4,7 +4,8 @@
|
|
4
4
|
<th>ID</th>
|
5
5
|
<th>Associated User</th>
|
6
6
|
<th>CSV File</th>
|
7
|
-
<th>
|
7
|
+
<th>Number of Works</th>
|
8
|
+
<th>Total Size</th>
|
8
9
|
</tr>
|
9
10
|
<% @csv_import_details.each do |csv_import_detail| %>
|
10
11
|
<tr>
|
@@ -18,7 +19,10 @@
|
|
18
19
|
<%= csv_import_detail.csv_import.manifest %>
|
19
20
|
</td>
|
20
21
|
<td>
|
21
|
-
<%= csv_import_detail.
|
22
|
+
<%= csv_import_detail.pre_ingest_works.count %>
|
23
|
+
</td>
|
24
|
+
<td>
|
25
|
+
<%= number_to_human_size(csv_import_detail.total_size) %>
|
22
26
|
</td>
|
23
27
|
</tr>
|
24
28
|
<% end %>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<li>Import created by: <%= User.find(@csv_import_detail.csv_import.user_id) %>
|
5
5
|
</li>
|
6
6
|
<li>CSV File: <%= @csv_import_detail.csv_import.manifest %></li>
|
7
|
-
<li>Total Size
|
7
|
+
<li>Total Size: <%= number_to_human_size(@csv_import_detail.total_size) %></li>
|
8
8
|
</ul>
|
9
9
|
|
10
10
|
<h3>Files</h3>
|
@@ -21,10 +21,9 @@
|
|
21
21
|
<%= pre_ingest_file.filename %>
|
22
22
|
</td>
|
23
23
|
<td>
|
24
|
-
<%= pre_ingest_file.size %>
|
24
|
+
<%= number_to_human_size(pre_ingest_file.size) %>
|
25
25
|
</td>
|
26
26
|
<td>
|
27
|
-
Row number:
|
28
27
|
<%= pre_ingest_file.row_number %>
|
29
28
|
</td>
|
30
29
|
</tr>
|
data/lib/zizia/version.rb
CHANGED
@@ -13,6 +13,6 @@ RSpec.describe 'viewing the csv import detail page' do
|
|
13
13
|
visit ('/csv_import_details/index')
|
14
14
|
expect(page).to have_content('CSV Imports ID')
|
15
15
|
click_on '1'
|
16
|
-
expect(page).to have_content('Total Size
|
16
|
+
expect(page).to have_content('Total Size')
|
17
17
|
end
|
18
18
|
end
|
@@ -241,9 +241,10 @@ RSpec.describe 'Importing records from a CSV file', :perform_jobs, :clean, type:
|
|
241
241
|
|
242
242
|
# Viewing additional details after an import
|
243
243
|
visit "/csv_import_details/index"
|
244
|
-
expect(page).to have_content('Total Size
|
244
|
+
expect(page).to have_content('Total Size')
|
245
245
|
find(:xpath, '//*[@id="content-wrapper"]/table/tbody/tr[2]/td[1]/a').click
|
246
246
|
expect(page).to have_content('dog.jpg')
|
247
|
+
expect(page).to have_content('5.74 MB')
|
247
248
|
end
|
248
249
|
end
|
249
250
|
end
|