From 643d148fab9a6b7259b7d44e3f0d8afc911e1ec8 Mon Sep 17 00:00:00 2001 From: Kristian Garza Date: Thu, 7 Nov 2019 18:59:18 +0100 Subject: [PATCH] allow import with cursor needed to import all missing doi metadata https://github.com/datacite/datacite/issues/785 --- app/models/event.rb | 2 +- lib/tasks/event.rake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/event.rb b/app/models/event.rb index 13b4c891a..c3c4f4637 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -410,7 +410,7 @@ def self.update_crossref(options={}) logger = Logger.new(STDOUT) size = (options[:size] || 1000).to_i - cursor = [(options[:cursor] || [])] + cursor = (options[:cursor] || []) response = Event.query(nil, source_id: "crossref", page: { size: 1, cursor: [] }) logger.info "[Update] #{response.results.total} events for source crossref." diff --git a/lib/tasks/event.rake b/lib/tasks/event.rake index 3b1f28e5b..727bf6d74 100644 --- a/lib/tasks/event.rake +++ b/lib/tasks/event.rake @@ -65,7 +65,7 @@ end namespace :crossref do desc 'Import crossref dois for all events' task :import_doi => :environment do - cursor = (ENV['CURSOR'] || Event.minimum(:id)).to_i + cursor = ENV['CURSOR'].to_s.split(",") || [Event.minimum(:id),Event.minimum(:id)] Event.update_crossref(cursor: cursor) end