From d6832a0550a704b515d42941b6270ef318ba3638 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Sun, 21 Apr 2024 20:08:25 -0500 Subject: [PATCH] Fix div by 0 --- judge/views/contests.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/judge/views/contests.py b/judge/views/contests.py index 0e71646..c88f177 100644 --- a/judge/views/contests.py +++ b/judge/views/contests.py @@ -902,7 +902,10 @@ class ContestStats(TitleMixin, ContestMixin, DetailView): if (point == None) or (problem_code not in codes): continue problem_idx = codes.index(problem_code) - bin_idx = math.floor(point * self.POINT_BIN / max_point) + if max_point > 0: + bin_idx = math.floor(point * self.POINT_BIN / max_point) + else: + bin_idx = 0 bin_idx = max(min(bin_idx, self.POINT_BIN), 0) counter[problem_idx][bin_idx] += count for i in range(num_problems):