From d53f9765583b38805c43dccdfc8ffbbbf0726aaa Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Wed, 15 May 2019 06:56:53 +0200 Subject: [PATCH] fix total_count. #257 --- app/graphql/types/funder_dataset_connection_with_meta_type.rb | 2 +- .../types/funder_publication_connection_with_meta_type.rb | 2 +- app/graphql/types/funder_software_connection_with_meta_type.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/graphql/types/funder_dataset_connection_with_meta_type.rb b/app/graphql/types/funder_dataset_connection_with_meta_type.rb index 0cb510510..0473a2e13 100644 --- a/app/graphql/types/funder_dataset_connection_with_meta_type.rb +++ b/app/graphql/types/funder_dataset_connection_with_meta_type.rb @@ -6,6 +6,6 @@ class FunderDatasetConnectionWithMetaType < GraphQL::Types::Relay::BaseConnectio field :total_count, Integer, null: false def total_count - Event.query(nil, obj_id: object[:id], citation_type: "Dataset-Funder").dig(:meta, "total").to_i + Event.query(nil, obj_id: object.parent[:id], citation_type: "Dataset-Funder").dig(:meta, "total").to_i end end diff --git a/app/graphql/types/funder_publication_connection_with_meta_type.rb b/app/graphql/types/funder_publication_connection_with_meta_type.rb index 36d6d8cb3..6b9fc501c 100644 --- a/app/graphql/types/funder_publication_connection_with_meta_type.rb +++ b/app/graphql/types/funder_publication_connection_with_meta_type.rb @@ -6,6 +6,6 @@ class FunderPublicationConnectionWithMetaType < GraphQL::Types::Relay::BaseConne field :total_count, Integer, null: false def total_count - Event.query(nil, obj_id: object[:id], citation_type: "Funder-JournalArticle").dig(:meta, "total").to_i + Event.query(nil, obj_id: object.parent[:id], citation_type: "Funder-JournalArticle").dig(:meta, "total").to_i end end diff --git a/app/graphql/types/funder_software_connection_with_meta_type.rb b/app/graphql/types/funder_software_connection_with_meta_type.rb index 382c4ad1e..1723f7b60 100644 --- a/app/graphql/types/funder_software_connection_with_meta_type.rb +++ b/app/graphql/types/funder_software_connection_with_meta_type.rb @@ -6,6 +6,6 @@ class FunderSoftwareConnectionWithMetaType < GraphQL::Types::Relay::BaseConnecti field :total_count, Integer, null: false def total_count - Event.query(nil, obj_id: object[:id], citation_type: "Funder-SoftwareSourceCode").dig(:meta, "total").to_i + Event.query(nil, obj_id: object.parent[:id], citation_type: "Funder-SoftwareSourceCode").dig(:meta, "total").to_i end end