Skip to content

Commit

Permalink
fix source_id. datacite/levriero#56
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jun 18, 2019
1 parent a409a01 commit 76f223b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -376,18 +376,18 @@ def self.update_datacite_crossref(options={})

size = (options[:size] || 1000).to_i

response = Event.query(nil, source_id: "datacite_crossref", page: { size: 1, cursor: 0 })
logger.info "[Update] #{response.results.total} events for source datacite_crossref."
response = Event.query(nil, source_id: "datacite-crossref", page: { size: 1, cursor: 0 })
logger.info "[Update] #{response.results.total} events for source datacite-crossref."

if response.results.total > 0
# walk through results using cursor
cursor = 0

while response.results.results.length > 0 do
response = Event.query(nil, source_id: "crossref", page: { size: size, cursor: cursor })
response = Event.query(nil, source_id: "datacite-crossref", page: { size: size, cursor: cursor })
break unless response.results.results.length > 0

logger.info "[Update] Updating #{response.results.results.length} datacite_crossref events starting with _id #{cursor + 1}."
logger.info "[Update] Updating #{response.results.results.length} datacite-crossref events starting with _id #{cursor + 1}."
cursor = response.results.to_a.last[:sort].first.to_i

response.results.results.each do |e|
Expand Down

0 comments on commit 76f223b

Please sign in to comment.