Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/datacite/lupo
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed May 29, 2020
2 parents c1396d5 + 9fe7683 commit eb1e587
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/models/concerns/indexable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def query(query, options={})
from = 0

# make sure we have a valid cursor
search_after = options.dig(:page, :cursor).is_a?(Array) || [1, "1"]
search_after = options.dig(:page, :cursor).is_a?(Array) ? options.dig(:page, :cursor) : [1, "1"]

if self.name == "Event"
sort = [{ created_at: "asc", uuid: "asc" }]
Expand Down
2 changes: 1 addition & 1 deletion app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ def self.query(query, options={})
from = 0

# make sure we have a valid cursor
search_after = options.dig(:page, :cursor).is_a?(Array) || [1, "1"]
search_after = options.dig(:page, :cursor).is_a?(Array) ? options.dig(:page, :cursor) : [1, "1"]
sort = [{ created: "asc", uid: "asc" }]
else
from = ((options.dig(:page, :number) || 1) - 1) * (options.dig(:page, :size) || 25)
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/event.rake
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace :event do

desc 'update registrant metadata'
task :update_registrant => :environment do
cursor = ENV['CURSOR'].to_s.split(",") || [Event.minimum(:id), Event.minimum(:id)]
cursor = ENV["CURSOR"].present? ? Base64.urlsafe_decode64(ENV["CURSOR"]).split(",", 2) : []

Event.update_registrant(cursor: cursor, size: ENV['SIZE'])
end
Expand Down
33 changes: 16 additions & 17 deletions spec/models/doi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -523,23 +523,22 @@
end
end

# TODO issue with search_after
# describe "transfer", elasticsearch: true do
# let(:provider) { create(:provider) }
# let(:client) { create(:client, provider: provider) }
# let(:target) { create(:client, provider: provider, symbol: provider.symbol + ".TARGET", name: "Target Client") }
# let!(:dois) { create_list(:doi, 5, client: client, aasm_state: "findable") }

# before do
# Doi.import
# sleep 2
# end

# it "transfer all dois" do
# response = Doi.transfer(client_id: client.symbol.downcase, client_target_id: target.symbol.downcase, size: 3)
# expect(response).to eq(5)
# end
# end
describe "transfer", elasticsearch: true do
let(:provider) { create(:provider) }
let(:client) { create(:client, provider: provider) }
let(:target) { create(:client, provider: provider, symbol: provider.symbol + ".TARGET", name: "Target Client") }
let!(:dois) { create_list(:doi, 5, client: client, aasm_state: "findable") }

before do
Doi.import
sleep 2
end

it "transfer all dois" do
response = Doi.transfer(client_id: client.symbol.downcase, client_target_id: target.symbol.downcase, size: 3)
expect(response).to eq(5)
end
end

describe "views" do
let(:client) { create(:client) }
Expand Down

0 comments on commit eb1e587

Please sign in to comment.