Skip to content

Commit

Permalink
handle missing contributors. #647
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Sep 29, 2020
1 parent 7f4fe69 commit 0095262
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/graphql/types/doi_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def fields_of_science
end

def creators(**args)
Array.wrap(object.creators[0...args[:first]]).map do |c|
Array.wrap(object.creators)[0...args[:first]].map do |c|
Hashie::Mash.new(
"id" => c.fetch("nameIdentifiers", []).find { |n| %w(ORCID ROR).include?(n.fetch("nameIdentifierScheme", nil)) }.to_h.fetch("nameIdentifier", nil),
"name_type" => c.fetch("nameType", nil),
Expand All @@ -297,7 +297,7 @@ def creators(**args)
end

def contributors(**args)
contrib = Array.wrap(object.contributors[0...args[:first]])
contrib = Array.wrap(object.contributors)[0...args[:first]]
contrib = contrib.select { |c| c["contributorType"] == args[:contributor_type] } if args[:contributor_type].present?
contrib.map do |c|
Hashie::Mash.new(
Expand Down

0 comments on commit 0095262

Please sign in to comment.