Skip to content

Commit

Permalink
update graphql by person. #425
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Mar 28, 2020
1 parent f813c3a commit 2334206
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/jobs/orcid_auto_update_by_id_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ def perform(id, options={})
end

def parse_message(message: nil)
given_names = message.dig("name", "given-names", "value")
given_name = message.dig("name", "given-names", "value")
family_name = message.dig("name", "family-name", "value")
if message.dig("name", "credit-name", "value").present?
name = message.dig("name", "credit-name", "value")
elsif given_names.present? || family_name.present?
name = [given_names, family_name].join(" ")
elsif given_name.present? || family_name.present?
name = [given_name, family_name].join(" ")
else
name = nil
end

{
"name" => name,
"givenNames" => given_names,
"givenName" => given_names,
"familyName" => family_name }.compact
end

Expand Down

0 comments on commit 2334206

Please sign in to comment.