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 Jun 15, 2021
2 parents 25af2af + 73d5504 commit a07786e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/graphql/types/person_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class PersonType < BaseObject
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :field_of_science, String, required: false
argument :user_id, String, required: false
argument :first, Int, required: false, default_value: 25
argument :after, String, required: false
end
Expand Down Expand Up @@ -199,10 +200,12 @@ def citation_count
end

def response(**args)
user_id = args[:user_id].present? ? args[:user_id] << object[:id] : object[:id]

Doi.gql_query(
args[:query],
ids: args[:ids],
user_id: object[:id],
user_id: user_id,
client_id: args[:repository_id],
provider_id: args[:member_id],
affiliation_id: args[:affiliation_id],
Expand Down
2 changes: 1 addition & 1 deletion app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ def self.gql_query(query, options = {})
filter << { term: { "client.re3data_id" => doi_from_url(options[:re3data_id]) } } if options[:re3data_id].present?
filter << { term: { "client.opendoar_id" => options[:opendoar_id] } } if options[:opendoar_id].present?
filter << { terms: { "client.certificate" => options[:certificate].split(",") } } if options[:certificate].present?
filter << { term: { "creators.nameIdentifiers.nameIdentifier" => "https://orcid.org/#{orcid_from_url(options[:user_id])}" } } if options[:user_id].present?
filter << { terms: { "creators.nameIdentifiers.nameIdentifier" => options[:user_id].split(",").collect { |id| "https://orcid.org/#{orcid_from_url(id)}" } } } if options[:user_id].present?
filter << { term: { "creators.nameIdentifiers.nameIdentifierScheme" => "ORCID" } } if options[:has_person].present?

# match either one of has_affiliation, has_organization, has_funder or has_member
Expand Down

0 comments on commit a07786e

Please sign in to comment.