Skip to content

Commit

Permalink
Add safe operator for downcase
Browse files Browse the repository at this point in the history
  • Loading branch information
codycooperross committed Sep 3, 2024
1 parent c4f171a commit f76cf4b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ def citation_count
# remove duplicate citing source dois,
# then show distribution by year
def citations_over_time
citation_events.pluck(:occurred_at, :source_doi).map { |v| [v[0], v[1].downcase] }.sort_by { |v| v[0] }.uniq { |v| v[1] }.
citation_events.pluck(:occurred_at, :source_doi).map { |v| [v[0], v[1]&.downcase] }.sort_by { |v| v[0] }.uniq { |v| v[1] }.
group_by { |v| v[0].utc.iso8601[0..3] }.
map { |k, v| { "year" => k, "total" => v.length } }.
sort_by { |h| h["year"] }
Expand Down

0 comments on commit f76cf4b

Please sign in to comment.