summaryrefslogtreecommitdiffstats
path: root/app/helpers/search_helper.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-08-02 21:54:21 +0000
committerGo MAEDA <maeda@farend.jp>2018-08-02 21:54:21 +0000
commiteee1c36b4b7f0cee23ebc5d3848fa2b606f603c8 (patch)
tree6618b8113ac99e4feb65ffbab90f87bc5da10349 /app/helpers/search_helper.rb
parentc76a021e92e77036152935ac19af10893f56669f (diff)
downloadredmine-eee1c36b4b7f0cee23ebc5d3848fa2b606f603c8.tar.gz
redmine-eee1c36b4b7f0cee23ebc5d3848fa2b606f603c8.zip
Replace Enumerable#sort with faster Enumerable#sort_by (#29299).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@17462 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/search_helper.rb')
-rw-r--r--app/helpers/search_helper.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index 8788711e7..d7c483048 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -55,7 +55,7 @@ module SearchHelper
def render_results_by_type(results_by_type)
links = []
# Sorts types by results count
- results_by_type.keys.sort {|a, b| results_by_type[b] <=> results_by_type[a]}.each do |t|
+ results_by_type.keys.sort_by {|k| results_by_type[k]}.reverse_each do |t|
c = results_by_type[t]
next if c == 0
text = "#{type_label(t)} (#{c})"