Skip to content

Commit

Permalink
Replace 'Unavailable' with 'Not requestable'; fixes #2005
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Feb 9, 2024
1 parent 46b6d7c commit 649daa3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/folio/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def status_class

# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def status_text
return temporary_location&.discovery_display_name || 'Unavailable' unless requestable?
return temporary_location&.discovery_display_name || 'Not requestable' unless requestable?

if !circulates?
'In-library use only'
Expand All @@ -120,7 +120,7 @@ def status_text
elsif hold_recallable?
status
else
'Unavailable'
'Not requestable'
end
end
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
Expand Down Expand Up @@ -214,7 +214,7 @@ def self.from_hash(dyn)
def availability_class
if hold_recallable?
'hold-recall'
elsif effective_location.details['availabilityClass'] == 'Offsite'
elsif effective_location.details['availabilityClass'] == 'Offsite' && requestable?
'deliver-from-offsite'
elsif status == STATUS_AVAILABLE && requestable?
'available'
Expand Down
21 changes: 21 additions & 0 deletions spec/factories/folio_api_json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -768,4 +768,25 @@
new(**attributes)
end
end

factory :aged_to_lost_holdings, class: 'Folio::Instance' do
id { '1234' }
title { 'One lost item' }

format { ['Book'] }

items do
[
build(:item,
barcode: '12345678',
callnumber: 'ABC 123',
status: 'Aged to Lost',
effective_location: build(:location, code: 'SAL3-STACKS'))
]
end

initialize_with do
new(**attributes)
end
end
end
14 changes: 14 additions & 0 deletions spec/helpers/requests_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,20 @@
expect(subject).to have_content('In-library use only')
end
end

describe 'with a non-pageable item' do
let(:holding) do
build(:aged_to_lost_holdings).items.first
end

it 'includes the status icon' do
expect(subject).to have_css('.unavailable')
end

it 'includes the status text' do
expect(subject).to have_content('Not requestable')
end
end
end

describe '#request_level_request_status' do
Expand Down

0 comments on commit 649daa3

Please sign in to comment.