Skip to content

Commit

Permalink
Merge pull request #985 from sul-dlss/migrate-err
Browse files Browse the repository at this point in the history
Move MIGRATE-ERR suppression into FolioRecord#sirsi_holdings instead of in the query
  • Loading branch information
cbeer authored Jul 18, 2023
2 parents 8a055c3 + efd377f commit 5ce9d04
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 2 additions & 0 deletions lib/folio_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ def sirsi_holdings
holding = holdings.find { |holding| holding['id'] == item['holdingsRecordId'] }
item_location_code = item.dig('location', 'permanentLocation', 'code')
item_location_code ||= holding.dig('location', 'permanentLocation', 'code')
next if item_location_code&.end_with? 'MIGRATE-ERR'

library_code, home_location_code = LocationsMap.for(item_location_code)
_current_library, current_location = LocationsMap.for(item.dig('location', 'location', 'code'))
current_location ||= folio_status_to_location(item['status'])
Expand Down
7 changes: 1 addition & 6 deletions lib/traject/readers/folio_postgres_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ def self.find_by_catkey(catkey, settings = {})
end

def default_filters
[suppress_shadowed_items, @settings['postgres.sql_filters']].compact
end

# exclude things that are shadowed in symphony, which are in locations that don't get mapped and thus end up in the "migration error" locations.
def suppress_shadowed_items
"item.effectivelocationid NOT IN (SELECT id from location WHERE jsonb ->> 'code' like '%MIGRATE-ERR')"
[@settings['postgres.sql_filters']].compact
end

def queries
Expand Down

0 comments on commit 5ce9d04

Please sign in to comment.