Skip to content

Commit

Permalink
typing results correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
kjgarza committed Feb 10, 2020
1 parent 0aa1f09 commit 18f3d31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/controllers/concerns/metrics_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def get_person_metrics(orcid)
end

def get_person_dois(orcid)
return [] if orcid.blank?

Event.query(nil, page: { size: 300 }, source_id: "datacite-orcid-auto-update", obj_id: "https://orcid.org/#{orcid}").results.to_a.map do |e|
doi_from_url(e.subj_id)
end
Expand Down
4 changes: 2 additions & 2 deletions app/queries/events_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def citations_right_query(dois, pids)
end

def citations(dois)
return nil if dois.blank?
return [] if dois.blank?

pids = dois.split(",").map do |doi|
Event.new.normalize_doi(doi)
Expand Down Expand Up @@ -156,7 +156,7 @@ def downloads_histogram(doi)
end

def views_and_downloads(dois)
return {} if dois.blank?
return [] if dois.blank?

query = "(relation_type_id:unique-dataset-requests-regular AND source_id:datacite-usage) OR (relation_type_id:unique-dataset-investigations-regular AND source_id:datacite-usage)"
results = Event.query(query, doi: dois, aggregations: "multiple_usage_count_aggregation", page: { size: 1, cursor: [] }).response.aggregations
Expand Down

0 comments on commit 18f3d31

Please sign in to comment.