Skip to content

Commit

Permalink
sums totals
Browse files Browse the repository at this point in the history
addresses #372
  • Loading branch information
kjgarza committed Dec 31, 2019
1 parent df8c477 commit 5f68b9d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/graphql/types/person_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,24 @@ def software_source_codes(**args)
end

def citation_count(**args)
dois = Event.query(nil, obj_id: https_to_http(object[:id])).results.to_a.lazy.map do |e|
dois = Event.query(nil, obj_id: https_to_http(object[:id])).results.to_a.map do |e|
doi_from_url(e.subj_id)
end
EventsQuery.new.citations(dois)
EventsQuery.new.citations(dois).sum {|h| h[:count] }
end

def view_count(**args)
dois = Event.query(nil, obj_id: https_to_http(object[:id])).results.to_a.lazy.map do |e|
dois = Event.query(nil, obj_id: https_to_http(object[:id])).results.to_a.map do |e|
doi_from_url(e.subj_id)
end
EventsQuery.new.views(dois)
EventsQuery.new.views(dois).sum {|h| h[:count] }
end

def download_count(**args)
dois = Event.query(nil, obj_id: https_to_http(object[:id])).results.to_a.lazy.map do |e|
dois = Event.query(nil, obj_id: https_to_http(object[:id])).results.to_a.map do |e|
doi_from_url(e.subj_id)
end
EventsQuery.new.downloads(dois)
EventsQuery.new.downloads(dois).sum {|h| h[:count] }
end

def https_to_http(url)
Expand Down

0 comments on commit 5f68b9d

Please sign in to comment.