summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-10-03 07:55:25 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-10-03 07:55:25 +0000
commit82ece8ad4584278ce437270470b54ff9b42c653b (patch)
treeef536719927eff289af8f94ca32024ec60c96f2e
parent4fde49d2558f5dd68bfe1f287aff9d9b700c5a69 (diff)
parent76a1a7a29d3b680b9be98051b57d6e0a2a9c8d3a (diff)
downloadgitlab-ce-82ece8ad4584278ce437270470b54ff9b42c653b.tar.gz
Merge branch 'ce-7014-epic-status-tabs' into 'master'
Extract status count key to a method See merge request gitlab-org/gitlab-ce!22021
-rw-r--r--app/finders/issuable_finder.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index 0209a1397b9..9e24154e4b6 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -128,7 +128,7 @@ class IssuableFinder
labels_count = 1 if use_cte_for_search?
finder.execute.reorder(nil).group(:state).count.each do |key, value|
- counts[Array(key).last.to_sym] += value / labels_count
+ counts[count_key(key)] += value / labels_count
end
counts[:all] = counts.values.sum
@@ -297,6 +297,10 @@ class IssuableFinder
klass.all
end
+ def count_key(value)
+ Array(value).last.to_sym
+ end
+
# rubocop: disable CodeReuse/ActiveRecord
def by_scope(items)
return items.none if current_user_related? && !current_user