Skip to content

Commit

Permalink
Merge pull request #754 from datacite/reduce_requests_for_aggs
Browse files Browse the repository at this point in the history
Reduce number of calls for aggregations in Researcher Profile
  • Loading branch information
kjgarza authored Aug 18, 2021
2 parents 475b5a0 + 120dffc commit b33ef06
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/graphql/types/person_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b33ef06

Please sign in to comment.