Browse Source

refactor: make filters_count more readable

pull/1768/head
natdeanlewissoftwire 3 years ago
parent
commit
a4a977f3fd
  1. 10
      app/helpers/filters_helper.rb

10
app/helpers/filters_helper.rb

@ -67,11 +67,11 @@ private
end end
def filters_count(filters) def filters_count(filters)
filters.values.sum do |category| filters.each.sum do |category, category_filters|
if category.is_a?(String) if %w[status years].include?(category)
category != "all" ? 1 : 0 category_filters.count(&:present?)
else elsif %w[user organisation].include?(category)
category.count(&:present?) category_filters != "all" ? 1 : 0
end end
end end
end end

Loading…
Cancel
Save