Commit 76a1a7a2 authored by Jarka Košanová's avatar Jarka Košanová

Extract status count key to a method

parent 97e2de1d
...@@ -128,7 +128,7 @@ class IssuableFinder ...@@ -128,7 +128,7 @@ class IssuableFinder
labels_count = 1 if use_cte_for_search? labels_count = 1 if use_cte_for_search?
finder.execute.reorder(nil).group(:state).count.each do |key, value| 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 end
counts[:all] = counts.values.sum counts[:all] = counts.values.sum
...@@ -297,6 +297,10 @@ class IssuableFinder ...@@ -297,6 +297,10 @@ class IssuableFinder
klass.all klass.all
end end
def count_key(value)
Array(value).last.to_sym
end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def by_scope(items) def by_scope(items)
return items.none if current_user_related? && !current_user return items.none if current_user_related? && !current_user
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment