Skip to content

Commit

Permalink
Merge pull request #1904 from sul-dlss/folio-locations
Browse files Browse the repository at this point in the history
If the passed in origin isn't a Symphony location, then treat it as a…
  • Loading branch information
thatbudakguy authored Oct 9, 2023
2 parents df1a002 + 262b76a commit c0485ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/models/library_location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 13 additions & 3 deletions spec/models/library_location_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c0485ad

Please sign in to comment.