Skip to content

Commit

Permalink
Merge branch '52-fix-bulkrax-oai-pmh-import-bugs' into 'master'
Browse files Browse the repository at this point in the history
Issue #52 - Fix Bulkrax OAI-PMH import bugs

See merge request unh-lit/hyrax!15
  • Loading branch information
svogtunh committed Jun 16, 2020
2 parents 8dbbdb7 + 8270bc3 commit 791edc3
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions app/overrides/bulkrax/oai_dc_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

# frozen_string_literal: true

class Bulkrax::OaiDcParser
module Bulkrax
class OaiDcParser

def create_works
results = self.records(quick: true)
Expand All @@ -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)
Expand All @@ -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")
Expand All @@ -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

0 comments on commit 791edc3

Please sign in to comment.