Skip to content

Commit

Permalink
support orcid id for dois. #283
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed May 27, 2019
1 parent 1f8f516 commit 7cbb276
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/graphql/types/researcher_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 7cbb276

Please sign in to comment.