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

Move MIGRATE-ERR suppression into FolioRecord#sirsi_holdings instead of in the query #985

Merged
merged 1 commit into from
Jul 18, 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
2 changes: 2 additions & 0 deletions lib/folio_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,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