app/models/cohortly/report.rb in cohortly-0.0.4 vs app/models/cohortly/report.rb in cohortly-0.0.5
- old
+ new
@@ -64,10 +64,10 @@
end
def percent_line(cohort_key)
line = report_line(cohort_key)
base = user_count_in_cohort(cohort_key)
- line.collect { |x| (x/base.to_f * 100).round }.unshift base
+ line.collect { |x| (x && base > 0.0 ) ? (x/base.to_f * 100).round : 0 }.unshift base
end
def report_totals
month_cohorts.collect do |cohort_key|
report_line(cohort_key)