lib/tabs/metrics/value/stats.rb in tabs-0.8.0 vs lib/tabs/metrics/value/stats.rb in tabs-0.8.1
- old
+ new
@@ -35,10 +35,11 @@
def max
@max ||= values.max_by { |v| v["max"] }["max"]
end
def avg
- round_float(self.sum.to_f / self.count.to_f)
+ return 0 if count.zero?
+ (self.sum.to_f / self.count.to_f).round(Config.decimal_precision)
end
def each(&block)
values.each(&block)
end