diff --git a/app/graphql/types/person_type.rb b/app/graphql/types/person_type.rb index a61820a42..8b9bcf7bb 100644 --- a/app/graphql/types/person_type.rb +++ b/app/graphql/types/person_type.rb @@ -182,20 +182,20 @@ def works(**args) def view_count args = { first: 0 } - r = response(args) - r.response.aggregations.view_count.value.to_i + @r = response(args) if @r.nil? + @r.response.aggregations.view_count.value.to_i end def download_count args = { first: 0 } - r = response(args) - r.response.aggregations.download_count.value.to_i + @r = response(args) if @r.nil? + @r.response.aggregations.download_count.value.to_i end def citation_count args = { first: 0 } - r = response(args) - r.response.aggregations.citation_count.value.to_i + @r = response(args) if @r.nil? + @r.response.aggregations.citation_count.value.to_i end def response(**args)