Skip to content

Commit

Permalink
Show additional information on batch page (#51)
Browse files Browse the repository at this point in the history
This shows additional information on the batch page:

* Overwrite Behaviour Type
* A default status to be replaced later

Connected to https://github.com/curationexperts/in-house/issues/424
  • Loading branch information
little9 authored and bess committed Oct 31, 2019
1 parent 0eb66a5 commit eeca15a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/models/zizia/csv_import_detail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ class CsvImportDetail < ::ApplicationRecord
has_many :pre_ingest_works
has_many :pre_ingest_files, through: :pre_ingest_works

def status
'undetermined'
end

def total_size
return 0 if pre_ingest_files.empty?
pre_ingest_files.map(&:size).sum
Expand Down
8 changes: 8 additions & 0 deletions app/views/zizia/csv_import_details/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<th>Number of Works</th>
<th>Number of Files</th>
<th>Total Size</th>
<th>Status</th>
<th>Overwrite Behavior Type</th>
</tr>
<% @csv_import_details.each do |csv_import_detail| %>
<tr>
Expand All @@ -32,6 +34,12 @@
<td>
<%= number_to_human_size(csv_import_detail.total_size) %>
</td>
<td>
<%= csv_import_detail.status %>
</td>
<td>
<%= csv_import_detail.update_actor_stack %>
</td>
</tr>
<% end %>
</table>
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20191029162902_add_status_to_csv_import_detail.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddStatusToCsvImportDetail < ActiveRecord::Migration[5.1]
def change
add_column :zizia_csv_import_details, :status, :string
end
end
1 change: 1 addition & 0 deletions spec/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@
t.integer "failure_count"
t.string "deduplication_field"
t.string "update_actor_stack"
t.string "status"
t.index ["csv_import_id"], name: "index_zizia_csv_import_details_on_csv_import_id"
end

Expand Down
14 changes: 14 additions & 0 deletions spec/dummy/spec/system/csv_import_details_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
it 'displays the metadata when you visit the page' do
visit ('/csv_import_details/index')
expect(page).to have_content('CSV Imports ID')
expect(page).to have_content('Status')
expect(page).to have_content('undetermined')
click_on '1'
expect(page).to have_content('Total Size')
end
Expand All @@ -34,6 +36,18 @@
expect(page).to have_content('October 29, 2019 14:20')
end

it 'displays undetermined for the status' do
visit ('/csv_import_details/index')
expect(page).to have_content('Status')
expect(page).to have_content('undetermined')
end

it 'displays the overwrite behavior type' do
visit ('/csv_import_details/index')
expect(page).to have_content('Overwrite Behavior Type')
expect(page).to have_content('HyraxMetadataOnly')
end

it 'has the dashboard layout' do
visit ('/csv_import_details/index')
expect(page).to have_content('Your activity')
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/csv_import_detail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
success_count { 1 }
failure_count { 0 }
deduplication_field { 'identifier' }
update_actor_stack { 'HyraxDefault' }
update_actor_stack { 'HyraxMetadataOnly' }
end
end

0 comments on commit eeca15a

Please sign in to comment.