Skip to content

Commit

Permalink
metrics per node
Browse files Browse the repository at this point in the history
  • Loading branch information
kjgarza committed Jan 6, 2020
1 parent 970d29f commit 839a17b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/graphql/types/event_data_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

class EventDataType < BaseObject
implements DoiItem
implements MetricInterface
end
6 changes: 3 additions & 3 deletions app/graphql/types/person_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,21 @@ def software_source_codes(**_args)
end

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

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

def download_count(**_args)
dois = Event.query(nil, obj_id: https_to_http(object[:id])).results.to_a.map do |e|
dois = Event.query(nil, page: { size: 100 }, obj_id: https_to_http(object[:id])).results.to_a.map do |e|
doi_from_url(e.subj_id)
end
EventsQuery.new.downloads(dois.join(",")).sum { |h| h[:count] }
Expand Down

0 comments on commit 839a17b

Please sign in to comment.