diff --git a/app/models/library_location.rb b/app/models/library_location.rb index 60136b4a9..d842162ff 100644 --- a/app/models/library_location.rb +++ b/app/models/library_location.rb @@ -16,8 +16,9 @@ def active_messages end # This is the code Folio uses, which is a combination of library & Symphony location + # In certain cases, this wasn't a Symphony location, so the location is a FOLIO location (e.g. BUSINESS/BUS-CRES) def folio_location_code - @folio_location_code ||= FolioLocationMap.folio_code_for(library_code: library, home_location: location) + @folio_location_code ||= FolioLocationMap.folio_code_for(library_code: library, home_location: location) || location rescue FolioLocationMap::NotFound Honeybadger.notify('Location code not found', context: { library:, location: }) nil diff --git a/spec/models/library_location_spec.rb b/spec/models/library_location_spec.rb index 3ff77ef0e..f0d4f37dc 100644 --- a/spec/models/library_location_spec.rb +++ b/spec/models/library_location_spec.rb @@ -18,9 +18,19 @@ subject { library_location.folio_location_code } let(:library_location) { described_class.new(origin, origin_location) } - let(:origin) { 'GREEN' } - let(:origin_location) { 'STACKS' } - it { is_expected.to eq 'GRE-STACKS' } + context 'a symphony location' do + let(:origin) { 'GREEN' } + let(:origin_location) { 'STACKS' } + + it { is_expected.to eq 'GRE-STACKS' } + end + + context 'a FOLIO location' do + let(:origin) { 'BUSINESS' } + let(:origin_location) { 'BUS-CRES' } + + it { is_expected.to eq 'BUS-CRES' } + end end end