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
def filters_count(filters)
filters.values.sum do |category|
if category.is_a?(String)
category != "all" ? 1 : 0
else
category.count(&:present?)
filters.each.sum do |category, category_filters|
if %w[status years].include?(category)
category_filters.count(&:present?)
elsif %w[user organisation].include?(category)
category_filters != "all" ? 1 : 0
end
end
end

Loading…
Cancel
Save