Fix ZeroDivisionError in question statistics

This commit is contained in:
Raphael Michel
2020-07-09 14:56:46 +02:00
parent 93e3cf1d99
commit 0f9ec2ce7d

View File

@@ -566,7 +566,7 @@ class QuestionView(EventPermissionRequiredMixin, QuestionMixin, ChartContainingV
r = list(qs)
total = sum(a['count'] for a in r)
for a in r:
a['percentage'] = a['count'] / total * 100.
a['percentage'] = (a['count'] / total * 100.) if total else 0
return r
def get_context_data(self, **kwargs):