summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2019-01-04 09:26:59 +0000
committerSean McGivern <sean@gitlab.com>2019-01-04 09:26:59 +0000
commit4543ef099d29b383462bcc1c71973c43385cd8dc (patch)
treeafd025be98e320da2449e013ef302b122892f670 /app/helpers
parent8600043bc71120399c7e97ff74cadc8d0ca1d4b1 (diff)
parent40f31486a8397c9142a0d5d0434b02d578aa8a67 (diff)
downloadgitlab-ce-4543ef099d29b383462bcc1c71973c43385cd8dc.tar.gz
Merge branch '44353-improve-snippet-search-performance' into 'master'
Remove redundant counts in snippets search Closes #44353 See merge request gitlab-org/gitlab-ce!23952
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/search_helper.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index 80cc568820a..0ee76a51f7d 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -24,10 +24,10 @@ module SearchHelper
end
def search_entries_info(collection, scope, term)
- return unless collection.count > 0
+ return if collection.to_a.empty?
from = collection.offset_value + 1
- to = collection.offset_value + collection.count
+ to = collection.offset_value + collection.to_a.size
count = collection.total_count
"Showing #{from} - #{to} of #{count} #{scope.humanize(capitalize: false)} for \"#{term}\""