Skip to content

Commit

Permalink
Fix for numberType being optional on number
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhallett committed Apr 19, 2021
1 parent deb2cdc commit 7439392
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/bolognese/readers/datacite_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@ def read_datacite(string: nil, **options)
"schemeType" => rii["schemeType"]
}.compact

number = ri["number"]
if number.is_a?(String)
number = number
numberType = nil
else
number = ri.dig("number", "__content__")
numberType = ri.dig("number", "numberType")
end

{
"relationType" => ri["relationType"],
"relatedItemType" => ri["relatedItemType"],
Expand All @@ -212,8 +221,8 @@ def read_datacite(string: nil, **options)
"publicationYear" => ri["publicationYear"],
"volume" => ri["volume"],
"issue" => ri["issue"],
"number" => ri.dig("number", "__content__"),
"numberType" => ri.dig("number", "numberType"),
"number" => number,
"numberType" => numberType,
"firstPage" => ri["firstPage"],
"lastPage" => ri["lastPage"],
"publisher" => ri["publisher"],
Expand Down

0 comments on commit 7439392

Please sign in to comment.