Skip to content

Commit

Permalink
Fix claim status being returned
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhallett committed Nov 23, 2021
1 parent 6dceba2 commit 9d8d0f5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/volpino.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

module Sinatra
module Volpino

# query Profiles server, check whether list of dois has been claimed by particular user
def get_claims(current_user, dois)
return {} unless current_user.present? && current_user.orcid.present? && dois.present?
Expand All @@ -18,7 +19,7 @@ def get_claims(current_user, dois)

def merge_claims(items, claims)
items.map do |item|
claim = Array(claims).find { |c| c.fetch('attributes', {}).fetch('doi', "claim") == item.fetch('attributes', {}).fetch('doi', "item") } || {}
claim = Array(claims).find { |c| c.fetch('attributes', {}).fetch('doi', "claim").end_with?(item.fetch('attributes', {}).fetch('doi', "item")) } || {}
item["attributes"]["claim-status"] = claim.fetch('attributes', {}).fetch('state', 'none')
item
end
Expand Down

0 comments on commit 9d8d0f5

Please sign in to comment.