Skip to content

Commit

Permalink
don't use pagination in a different way
Browse files Browse the repository at this point in the history
  • Loading branch information
kjgarza committed Jan 29, 2020
1 parent 4c414cf commit 8cb1f0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,9 @@ def access_method
end

def self.subj_id_check(options = {})
file_name = "events_with_double_crossref_dois.txt"
file_name = "evens_with_double_crossref_dois.txt"
size = (options[:size] || 1000).to_i
cursor = (options[:cursor] || [])
cursor = [options[:from_id], options[:until_id]]
total_errors = 0

response = Event.query(nil, source_id: "datacite-crossref,datacite-related", page: { size: 1, cursor: [] })
Expand Down Expand Up @@ -523,7 +523,7 @@ def self.subj_id_check(options = {})

file = File.open(file_name)
if file.present?
payload = { description: "events_with_errors_from_rake_task", public: true,files: {uids_with_errors: {content: file.read} }}
payload = { description: "events_with_errors_from_rake_task #{Time.now.getutc}", public: true,files: {uids_with_errors: {content: file.read} }}
### max file size 1MB
response = Maremma.post("https://api.github.com/gists", data: payload.to_json, username: ENV["GIST_USERNAME"], password:ENV["GIST_PASSWORD"])
logger.warn "[DoubleCheck] Total number of events with Errors: #{total_errors}"
Expand Down
7 changes: 4 additions & 3 deletions lib/tasks/event.rake
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ end
namespace :subj_id_check do
desc 'checks that events subject node congruency'
task :check => :environment do
cursor = ENV['CURSOR'].to_s.split(",") || [Event.minimum(:id),Event.maximum(:id)]

Event.subj_id_check(cursor: cursor)
from_id = (ENV['FROM_ID'] || Event.minimum(:id)).to_i
until_id = (ENV['UNTIL_ID'] || Event.maximum(:id)).to_i

Event.subj_id_check(from_id: from_id, until_id: until_id)
end
end

Expand Down

0 comments on commit 8cb1f0f

Please sign in to comment.