From 8270bc3beaf5ddedd55cdc30c166b64712e302a6 Mon Sep 17 00:00:00 2001 From: Suzanne Vogt Date: Tue, 16 Jun 2020 04:16:48 -0400 Subject: [PATCH] Issue #52 - Fix Bulkrax OAI-PMH import bugs --- app/overrides/bulkrax/oai_dc_parser.rb | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/app/overrides/bulkrax/oai_dc_parser.rb b/app/overrides/bulkrax/oai_dc_parser.rb index b0be3cd..f9a388d 100644 --- a/app/overrides/bulkrax/oai_dc_parser.rb +++ b/app/overrides/bulkrax/oai_dc_parser.rb @@ -2,7 +2,8 @@ # frozen_string_literal: true -class Bulkrax::OaiDcParser +module Bulkrax + class OaiDcParser def create_works results = self.records(quick: true) @@ -16,6 +17,7 @@ def create_works # # CODE BLOCK 1 # + seen[record.identifier] = true new_entry = entry_class.where(importerexporter: self.importerexporter, identifier: record.identifier).first_or_create! ImportWorkJob.send(perform_method, new_entry.id, importerexporter.current_importer_run.id) @@ -27,6 +29,7 @@ def create_works # # CODE BLOCK 2 # + =begin #if record.identifier.end_with?("yearbook:1909") #if record.identifier.end_with?("acworth:0001") @@ -47,21 +50,5 @@ def create_works end end + end end - - def create_works - results = self.records(quick: true) - return unless results.present? - results.full.each_with_index do |record, index| - break if limit_reached?(limit, index) - if record.deleted? # TODO: record.status == "deleted" - importerexporter.current_importer_run.deleted_records += 1 - importerexporter.current_importer_run.save! - else - seen[record.identifier] = true - new_entry = entry_class.where(importerexporter: self.importerexporter, identifier: record.identifier).first_or_create! - ImportWorkJob.send(perform_method, new_entry.id, importerexporter.current_importer_run.id) - increment_counters(index) - end - end - end \ No newline at end of file