From 839a17b0462df6dcbd24c5de654fad62a74b3849 Mon Sep 17 00:00:00 2001 From: kjgarza Date: Mon, 6 Jan 2020 12:51:47 +0100 Subject: [PATCH] metrics per node --- app/graphql/types/event_data_type.rb | 1 + app/graphql/types/person_type.rb | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/graphql/types/event_data_type.rb b/app/graphql/types/event_data_type.rb index d6fec484c..50ae18fa1 100644 --- a/app/graphql/types/event_data_type.rb +++ b/app/graphql/types/event_data_type.rb @@ -2,4 +2,5 @@ class EventDataType < BaseObject implements DoiItem + implements MetricInterface end diff --git a/app/graphql/types/person_type.rb b/app/graphql/types/person_type.rb index 86fccc0c4..2870b938e 100644 --- a/app/graphql/types/person_type.rb +++ b/app/graphql/types/person_type.rb @@ -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] }