Skip to content

Commit

Permalink
Merge pull request #957 from sul-dlss/sdr-is-internet
Browse files Browse the repository at this point in the history
Map SUL/SDR location to SUL/INTERNET for parity
  • Loading branch information
cbeer authored Jul 5, 2023
2 parents aa05166 + eaad700 commit 1f9bbed
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
11 changes: 7 additions & 4 deletions lib/locations_map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require 'csv'

# This starts with the location.tsv file provided by libsys. We make any modifications to that data here.
class LocationsMap
include Singleton

Expand All @@ -16,14 +17,16 @@ def data

def load_map
CSV.parse(File.read(File.join(__dir__, 'translation_maps', 'locations.tsv')),
col_sep: "\t").each_with_object({}) do |row, hash|
library_code = row[1]
col_sep: "\t").each_with_object({}) do |(home_location, library_code, folio_code), hash|
library_code = { 'LANE' => 'LANE-MED' }.fetch(library_code, library_code)

# SAL3's CDL/ONORDER/INPROCESS locations are all mapped so SAL3-STACKS
next if row[2] == 'SAL3-STACKS' && row[0] != 'STACKS'
next if folio_code == 'SAL3-STACKS' && home_location != 'STACKS'

hash[row[2]] ||= [library_code, row[0]]
# Recode SUL-SDR to have "INTERNET" be it's home_locaion
home_location = 'INTERNET' if home_location == 'SDR'

hash[folio_code] ||= [library_code, home_location]
end
end
end
4 changes: 2 additions & 2 deletions spec/integration/compare_sirsi_and_folio_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@
'a10690790', # ezproxy prefix
'a81622', # missing status
'a14644326', # in-process status
'a3118108' # missing status
'a3118108', # missing status
'a10146027' # SUL/SDR instead of SUL/INTERNET
].each do |catkey|
context "catkey #{catkey}" do
let(:catkey) { catkey }
Expand All @@ -179,7 +180,6 @@
'a515836', # funky call-number problems
'a6634796', # missing call number in item_display
'a1553634', # migration error holdings
'a10146027', # SUL/SDR instead of SUL/INTERNET
'a12264341', # extra electronic items
'a9335111', # missing bound-withs
'a14461522', # ???
Expand Down
16 changes: 16 additions & 0 deletions spec/lib/folio/eresource_holdings_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,20 @@

it { expect(holdings).to be_empty }
end

context 'the holding location is SUL-SDR' do
let(:items_and_holdings) do
{ 'items' => [],
'holdings' =>
[{ 'location' =>
{ 'permanentLocation' =>
{ 'code' => 'SUL-SDR' },
'effectiveLocation' =>
{ 'code' => 'SUL-SDR' } },
'suppressFromDiscovery' => false,
'id' => '81a56270-e8dd-5759-8083-5cc96cdf0045',
'holdingsStatements' => [] }] }
end
it { expect(holdings.first.home_location).to eq 'INTERNET' }
end
end

0 comments on commit 1f9bbed

Please sign in to comment.