From 42062a454a650d81d9fe6dddde7b39b056ec0a88 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Thu, 24 Aug 2017 18:17:04 +0200 Subject: Re-use issue/MR counts for the pagination system This changes the issue and MR index pages so the pagination system re-uses the output of the COUNT(*) query used to calculate the number of rows per state (opened, closed, etc). This removes the need for an additional COUNT(*) on both pages. --- app/helpers/issuables_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/helpers') diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index 681615dbf3e..717abf2082d 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -240,7 +240,8 @@ module IssuablesHelper def issuables_count_for_state(issuable_type, state) finder = public_send("#{issuable_type}_finder") # rubocop:disable GitlabSecurity/PublicSend - finder.count_by_state[state] + + Gitlab::IssuablesCountForState.new(finder)[state] end def close_issuable_url(issuable) -- cgit v1.2.1