diff --git a/app/models/bulkrax/importer.rb b/app/models/bulkrax/importer.rb index 94c400f3..efa43295 100644 --- a/app/models/bulkrax/importer.rb +++ b/app/models/bulkrax/importer.rb @@ -195,10 +195,19 @@ def import_objects(types_array = nil) end end parser.create_objects(types) + mark_unseen_as_skipped rescue StandardError => e set_status_info(e) end + # After an import any entries we did not touch are skipped. + # They are not really pending, complete for the last run, or failed + def mark_unseen_as_skipped + entries.where.not(id. seen).find_each do |entry| + entry.set_status_info('Skipped') + end + end + # Prepend the base_url to ensure unique set identifiers # @todo - move to parser, as this is OAI specific def unique_collection_identifier(id) diff --git a/app/models/concerns/bulkrax/status_info.rb b/app/models/concerns/bulkrax/status_info.rb index 02ce1883..c48dc58e 100644 --- a/app/models/concerns/bulkrax/status_info.rb +++ b/app/models/concerns/bulkrax/status_info.rb @@ -13,6 +13,7 @@ module StatusInfo scope :failed, -> { where(status_message: 'Failed') } scope :complete, -> { where(status_message: 'Complete') } scope :pending, -> { where(status_message: 'Pending') } + scope :skipped, -> { where(status_message: 'Skipped') } end def current_status @@ -28,6 +29,10 @@ def succeeded? current_status&.status_message&.match(/^Complete$/) end + def skipped? + current_status&.status_message&.match('Skipped') + end + def status current_status&.status_message || 'Pending' end