Skip to content

Commit

Permalink
handle last page of cursor-based pagination. #202
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Feb 10, 2019
1 parent 4620e3b commit 4c828e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ def self.set_handle
while cursor > prev_cursor do
response = Doi.query("-registered:* +url:* -aasm_state:draft -provider_id:ethz -provider_id:europ", page: { size: 1000, cursor: cursor })
prev_cursor = cursor
cursor = Array.wrap(response.results.results.last[:sort]).first
cursor = Array.wrap(response.results.results.last.to_h[:sort]).first

response.results.results.each do |d|
HandleJob.perform_later(d.doi)
Expand All @@ -791,7 +791,7 @@ def self.set_url
while cursor > prev_cursor do
response = Doi.query("-url:* (+provider_id:ethz OR -aasm_status:draft)", page: { size: 1000, cursor: cursor })
prev_cursor = cursor
cursor = Array.wrap(response.results.results.last[:sort]).first
cursor = Array.wrap(response.results.results.last.to_h[:sort]).first

response.results.results.each do |d|
UrlJob.perform_later(d.doi)
Expand All @@ -814,7 +814,7 @@ def self.set_minted
while cursor > prev_cursor do
response = Doi.query("url:* +provider_id:ethz +aasm_state:draft", page: { size: 1000, cursor: cursor })
prev_cursor = cursor
cursor = Array.wrap(response.results.results.last[:sort]).first
cursor = Array.wrap(response.results.results.last.to_h[:sort]).first

response.results.results.each do |d|
UrlJob.perform_later(d.doi)
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/_version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Lupo
class Application
VERSION = "2.3.29"
VERSION = "2.3.30"
end
end

0 comments on commit 4c828e6

Please sign in to comment.