Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix for division by 0

  • Loading branch information...
commit 8841dcf4d19dfbf002f3d7058f4011cb9bb7e018 1 parent 5d5e4c8
David Cramer authored committed
Showing with 4 additions and 1 deletion.
  1. +4 −1 django_histograms/utils.py
View
5 django_histograms/utils.py
@@ -113,7 +113,10 @@ def get_report(self):
total = sum(o for m in months.itervalues() for o in m[1])
max_num = max(o for m in months.itervalues() for o in m[1])
- ratio = total / max_num * 100
+ if not (total and max_num):
+ ratio = 0
+ else:
+ ratio = total / max_num * 100
return {
"results": months.values(),
Please sign in to comment.
Something went wrong with that request. Please try again.