From d6a306036aae72bd7b3825f82f831331285e6e5e Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 17 Jan 2020 17:55:18 +0100 Subject: [PATCH] Fix divisionbyzero --- royalpack/tables/triviascores.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/royalpack/tables/triviascores.py b/royalpack/tables/triviascores.py index e808e89d..49538544 100644 --- a/royalpack/tables/triviascores.py +++ b/royalpack/tables/triviascores.py @@ -34,6 +34,8 @@ class TriviaScore: @property def correct_rate(self): + if self.total_answers == 0: + return 0.0 return self.correct_answers / self.total_answers @property