From efd377ff650ac5c81ef3ce6d47324317396958dc Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Tue, 18 Jul 2023 07:53:03 -0700 Subject: [PATCH] Move MIGRATE-ERR suppression into FolioRecord#sirsi_holdings instead of in the query --- lib/folio_record.rb | 2 ++ lib/traject/readers/folio_postgres_reader.rb | 7 +------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/folio_record.rb b/lib/folio_record.rb index 0b7327f17..fc73ad20f 100644 --- a/lib/folio_record.rb +++ b/lib/folio_record.rb @@ -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']) diff --git a/lib/traject/readers/folio_postgres_reader.rb b/lib/traject/readers/folio_postgres_reader.rb index 39b3f7e46..2291a3877 100644 --- a/lib/traject/readers/folio_postgres_reader.rb +++ b/lib/traject/readers/folio_postgres_reader.rb @@ -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