diff --git a/app/controllers/concerns/facetable.rb b/app/controllers/concerns/facetable.rb index 77f23a67c..2fef2498e 100644 --- a/app/controllers/concerns/facetable.rb +++ b/app/controllers/concerns/facetable.rb @@ -34,10 +34,16 @@ def facet_by_year(arr) end def metric_facet_by_year(arr) - arr.map do |hsh| - { "id" => hsh["key_as_string"][0..3], - "title" => hsh["key_as_string"][0..3], - "count" => hsh.dig("metric_count", "value").to_i } + arr.reduce([]) do |sum, hsh| + if hsh.dig("metric_count", "value").to_i > 0 + sum << { + "id" => hsh["key_as_string"][0..3], + "title" => hsh["key_as_string"][0..3], + "count" => hsh.dig("metric_count", "value").to_i + } + end + + sum end end