From 8f42b25e688c0de2af57d1b4323909c37f1581aa Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Thu, 28 Feb 2013 23:36:08 -0500 Subject: [PATCH] Use lowest tag count as minimum --- app/models/stats/tag_cloud.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/models/stats/tag_cloud.rb b/app/models/stats/tag_cloud.rb index 400400e4..0fb68215 100644 --- a/app/models/stats/tag_cloud.rb +++ b/app/models/stats/tag_cloud.rb @@ -25,23 +25,19 @@ module Stats private def max - @max ||= tag_counts.max + @max ||= counts.max end - # 2013-02-28: Possible bug. - # The original code always set the minimum to zero. - # This might need to use tag_counts.min - # https://github.com/TracksApp/tracks/commit/8c26ea7cb596c97e37213c0cc994e66ee5fd27b0#commitcomment-2719199 def min - 0 + @min ||= counts.min end def divisor @divisor ||= ((max - min) / levels) + 1 end - def tag_counts - @tag_counts ||= tags.map {|t| t.count.to_i} + def counts + @counts ||= tags.map {|t| t.count.to_i} end def top_tags