From 7cbb276d540a946933097fa3771f24186d1e15c1 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Mon, 27 May 2019 20:01:57 +0200 Subject: [PATCH] support orcid id for dois. #283 --- app/graphql/types/researcher_type.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/graphql/types/researcher_type.rb b/app/graphql/types/researcher_type.rb index d26272f57..8073a6dff 100644 --- a/app/graphql/types/researcher_type.rb +++ b/app/graphql/types/researcher_type.rb @@ -21,6 +21,10 @@ class ResearcherType < BaseObject argument :first, Int, required: false, default_value: 25 end + def id + object.fetch(:id, nil) || object.fetch("nameIdentifiers", []).find { |n| n.fetch("nameIdentifierScheme", nil) == "ORCID" }.fetch("nameIdentifier", nil) + end + def datasets(**args) ids = Event.query(nil, obj_id: https_to_http(object[:id]), citation_type: "Dataset-Person").fetch(:data, []).map do |e| doi_from_url(e[:subj_id])