Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/views/checkouts/index.text.ruby
Original file line number Diff line number Diff line change
@@ -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),
Expand All @@ -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
11 changes: 5 additions & 6 deletions spec/system/checkouts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,17 @@
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)
visit checkouts_path(days_overdue: 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
Loading