diff --git a/app/views/checkouts/index.text.ruby b/app/views/checkouts/index.text.ruby index 32e0097a1..74ffa3568 100644 --- a/app/views/checkouts/index.text.ruby +++ b/app/views/checkouts/index.text.ruby @@ -1,5 +1,6 @@ CSV.generate(col_sep: "\t", row_sep: "\r\n") do |csv| csv << (%w(username user_number item_identifier title checked_out_at due_date checked_in_at) << "(created_at: #{Time.zone.now})").flatten + csv << 'reservation_count' if params[:view] == 'overdue' @checkouts.each do |checkout| csv << [ checkout.user.try(:username), @@ -10,5 +11,7 @@ CSV.generate(col_sep: "\t", row_sep: "\r\n") do |csv| checkout.due_date, checkout.checkin.try(:created_at) ] + + csv << checkout.item.manifestation.reserves.waiting.count if params[:view] == 'overdue' end end diff --git a/spec/system/checkouts_spec.rb b/spec/system/checkouts_spec.rb index fc4f1b410..88781593f 100644 --- a/spec/system/checkouts_spec.rb +++ b/spec/system/checkouts_spec.rb @@ -29,12 +29,6 @@ expect(page).to have_content checkouts(:checkout_00001).user.username expect(page).to have_content checkouts(:checkout_00001).user.profile.user_number end - end - - describe 'When not logged in', solr: true do - before(:each) do - Checkout.reindex - end it 'should contain query params in the facet' do sign_in users(:librarian1) @@ -42,5 +36,10 @@ expect(page).to have_link 'RSS', href: checkouts_path(format: :rss, days_overdue: 10) expect(page).to have_link 'TSV', href: checkouts_path(format: :txt, days_overdue: 10, locale: 'ja') end + + it 'should export checkouts to TSV' do + sign_in users(:librarian1) + visit checkouts_path(format: :txt) + end end end