Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont display where to find it when the item is in Remote Storage #3852 #3857

Merged
merged 1 commit into from
Nov 30, 2023
Merged
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
7 changes: 7 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,16 @@ def holding_requests_adapter
HoldingRequestsAdapter.new(@document, Bibdata)
end

# Returns true for locations with remote storage.
# Remote storage locations have a value of 'recap_rmt' in Alma.
def remote_storage?(location_code)
Bibdata.holding_locations[location_code]["remote_storage"] == 'recap_rmt'
end

# Returns true for locations where the user can walk and fetch an item.
# Currently this logic is duplicated in Javascript code in availability.es6
def find_it_location?(location_code)
return false if remote_storage?(location_code)
return false if (location_code || "").start_with?("plasma$", "marquand$")

return false if StackmapService::Url.missing_stackmap_reserves.include?(location_code)
Expand Down
10 changes: 5 additions & 5 deletions spec/helpers/holding_block_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@
'3668455' => {
location: 'Firestone Library',
library: 'Firestone Library',
location_code: 'f',
location_code: 'firestone$se',
call_number: 'PS3539.A74Z93 2000'
},
'4362737' => {
location: 'Firestone Library',
library: 'Firestone Library',
location_code: 'f',
location_code: 'firestone$se',
call_number: 'PS3539.A74Z93 2000'
}
}.to_json.to_s
Expand Down Expand Up @@ -579,8 +579,8 @@
end

context '#holding_block record show - online holdings' do
before { stub_alma_holding_locations }
it 'link missing label appears when 856s is missing from elf location' do
stub_holding_locations
expect(show_result.first).to include 'Link Missing'
end
end
Expand Down Expand Up @@ -615,14 +615,14 @@
'22270490580006421' => {
location: '',
library: 'Very Special Library',
location_code: 'xspecial&nil',
location_code: 'mendel$stacks',
call_number: 'special',
call_number_browse: 'special'
}
}.to_json.to_s
end

before { stub_holding_locations }
before { stub_alma_holding_locations }

it 'returns a string with call number and location display values' do
expect(show_result.last).to include call_number
Expand Down
18 changes: 12 additions & 6 deletions spec/services/physical_holdings_markup_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
holding_id => {
location:,
library: 'Firestone Library',
location_code: 'f',
location_code: 'firestone$stacks',
call_number:,
shelving_title:,
supplements:,
Expand Down Expand Up @@ -117,7 +117,7 @@

it 'includes a link with mapping details' do
expect(holding_location_markup).to include '<td class="library-location"'
expect(holding_location_markup).to include "href=\"/catalog/123456/stackmap?loc=f&amp;cn=#{call_number}\""
expect(holding_location_markup).to include "href=\"/catalog/123456/stackmap?loc=firestone$stacks&amp;cn=#{call_number}\""
expect(holding_location_markup).to include 'Firestone Library'
expect(holding_location_markup).to include 'data-holding-id="3668455"'
expect(holding_location_markup).to include "data-map-location=\"#{holding.first[1]['location_code']}"
Expand Down Expand Up @@ -699,7 +699,7 @@

describe 'Special collections location with suppressed button' do
before do
stub_holding_locations
stub_alma_holding_locations
allow(document).to receive(:to_s).and_return('99125501031906421')
allow(adapter).to receive(:document).and_return(document)
allow(adapter).to receive(:doc_id).and_return('99125501031906421')
Expand Down Expand Up @@ -752,9 +752,15 @@
expect(holding_location_markup).to include '<span class="location-text"'
expect(holding_location_markup).to include 'Remote Storage (ReCAP): Manuscripts. Special Collections Use Only'
expect(holding_location_markup).to include 'data-holding-id="22939015790006421"'
expect(holding_location_markup).to include "data-map-location=\"#{holding.first[1]['location_code']}"
expect(holding_location_markup).to include "data-location-library=\"#{holding.first[1]['library']}"
expect(holding_location_markup).to include "data-location-name=\"#{location}"
end

context 'Is a remote storage location rare$xmr' do
it 'does not have a -where to find- it element' do
expect(holding_location_markup).not_to include "title"
expect(holding_location_markup).not_to include "data-map-location"
expect(holding_location_markup).not_to include "data-location-library"
expect(holding_location_markup).not_to include "data-location-name"
end
end

it 'generates a "service-conditional" class' do
Expand Down