Skip to content

Commit

Permalink
Account for nil related_identifiers when indexing related_dois
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhoads committed Dec 7, 2023
1 parent 489f757 commit 35690c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/doi/indexer/related_doi_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
module Doi::Indexer
class RelatedDoiIndexer
def initialize(related_identifiers)
@related_identifiers = related_identifiers
@related_identifiers = Array.wrap(related_identifiers)
@related_dois = nil
end

def related_dois
@related_dois ||= @related_identifiers.select { |r| r["relatedIdentifierType"] == "DOI" }
@related_dois ||= @related_identifiers.select { |r| r.fetch("relatedIdentifierType", nil) == "DOI" }
end

def related_grouped_by_id
Expand Down

0 comments on commit 35690c4

Please sign in to comment.