From 5cc01e58834cd04dd8686b3556ef6a47761dc420 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Wed, 15 May 2019 06:57:14 +0200 Subject: [PATCH] fix total_count for researchers. #258 --- .../types/researcher_dataset_connection_with_meta_type.rb | 2 +- .../types/researcher_publication_connection_with_meta_type.rb | 2 +- .../types/researcher_software_connection_with_meta_type.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/graphql/types/researcher_dataset_connection_with_meta_type.rb b/app/graphql/types/researcher_dataset_connection_with_meta_type.rb index f43f96366..030731b78 100644 --- a/app/graphql/types/researcher_dataset_connection_with_meta_type.rb +++ b/app/graphql/types/researcher_dataset_connection_with_meta_type.rb @@ -6,7 +6,7 @@ class ResearcherDatasetConnectionWithMetaType < GraphQL::Types::Relay::BaseConne field :total_count, Integer, null: false def total_count - Event.query(nil, obj_id: https_to_http(object[:id]), citation_type: "Dataset-Person").dig(:meta, "total").to_i + Event.query(nil, obj_id: https_to_http(object.parent[:id]), citation_type: "Dataset-Person").dig(:meta, "total").to_i end def https_to_http(url) diff --git a/app/graphql/types/researcher_publication_connection_with_meta_type.rb b/app/graphql/types/researcher_publication_connection_with_meta_type.rb index e848aeaf5..beeb9131b 100644 --- a/app/graphql/types/researcher_publication_connection_with_meta_type.rb +++ b/app/graphql/types/researcher_publication_connection_with_meta_type.rb @@ -6,7 +6,7 @@ class ResearcherPublicationConnectionWithMetaType < GraphQL::Types::Relay::BaseC field :total_count, Integer, null: false def total_count - Event.query(nil, obj_id: https_to_http(object[:id]), citation_type: "JournalArticle-Person").dig(:meta, "total").to_i + Event.query(nil, obj_id: https_to_http(object.parent[:id]), citation_type: "JournalArticle-Person").dig(:meta, "total").to_i end def https_to_http(url) diff --git a/app/graphql/types/researcher_software_connection_with_meta_type.rb b/app/graphql/types/researcher_software_connection_with_meta_type.rb index d1d64c93e..78555f94e 100644 --- a/app/graphql/types/researcher_software_connection_with_meta_type.rb +++ b/app/graphql/types/researcher_software_connection_with_meta_type.rb @@ -6,7 +6,7 @@ class ResearcherSoftwareConnectionWithMetaType < GraphQL::Types::Relay::BaseConn field :total_count, Integer, null: false def total_count - Event.query(nil, obj_id: https_to_http(object[:id]), citation_type: "Person-SoftwareSourceCode").dig(:meta, "total").to_i + Event.query(nil, obj_id: https_to_http(object.parent[:id]), citation_type: "Person-SoftwareSourceCode").dig(:meta, "total").to_i end def https_to_http(url)