Fix div by 0

This commit is contained in:
cuom1999 2024-04-21 20:08:25 -05:00
parent 86815fb460
commit d6832a0550

View file

@ -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)
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):