From 1cdcc6bfb251f9571e58167cc27091e278ebab80 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Fri, 2 Oct 2020 05:47:39 +0200 Subject: [PATCH] user lowercase doi in claims query. #623 --- app/graphql/resolvers/claims.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/graphql/resolvers/claims.rb b/app/graphql/resolvers/claims.rb index 59b5adaa4..8a325cfe3 100644 --- a/app/graphql/resolvers/claims.rb +++ b/app/graphql/resolvers/claims.rb @@ -8,14 +8,14 @@ def resolve # Use DataCite Claims API call to get all ORCID claims for a given DOI api_url = Rails.env.production? ? "https://api.datacite.org" : "https://api.stage.datacite.org" - url = "#{api_url}/claims?user-id=#{context[:current_user].uid}&dois=#{object.doi}" + url = "#{api_url}/claims?user-id=#{context[:current_user].uid}&dois=#{object.doi.downcase}" response = Maremma.get(url, bearer: context[:current_user].jwt) if response.status != 200 - Rails.logger.error "Error retrieving claims for user #{context[:current_user].uid} and doi #{object.doi}: " + response.body["errors"].inspect + Rails.logger.error "Error retrieving claims for user #{context[:current_user].uid} and doi #{object.doi.downcase}: " + response.body["errors"].inspect return [] end - Rails.logger.info "Claims for user #{context[:current_user].uid} and doi #{object.doi} retrieved: " + response.body["data"].inspect + Rails.logger.info "Claims for user #{context[:current_user].uid} and doi #{object.doi.downcase} retrieved: " + response.body["data"].inspect Array.wrap(response.body.dig("data")).map do |claim| { id: claim["id"],