From 4c828e6d1a7c648ea641d4fb39111d46f2db7eb9 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sun, 10 Feb 2019 21:59:41 +0100 Subject: [PATCH] handle last page of cursor-based pagination. #202 --- app/models/doi.rb | 6 +++--- config/initializers/_version.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/doi.rb b/app/models/doi.rb index b802b49bf..4349a64d0 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -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) @@ -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) @@ -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) diff --git a/config/initializers/_version.rb b/config/initializers/_version.rb index 74aeac24f..9bbd4864c 100644 --- a/config/initializers/_version.rb +++ b/config/initializers/_version.rb @@ -1,5 +1,5 @@ module Lupo class Application - VERSION = "2.3.29" + VERSION = "2.3.30" end end \ No newline at end of file