From 8b7698c9f495d71766e32b52ca427d2231d757f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nut=CC=A6iu?= Date: Sat, 22 Apr 2017 01:40:03 +0300 Subject: [PATCH] Fixing get_highest_score zero division --- src/resources/utilities.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/resources/utilities.py b/src/resources/utilities.py index 616f370..9917f10 100644 --- a/src/resources/utilities.py +++ b/src/resources/utilities.py @@ -90,7 +90,11 @@ def get_highest_score(): """ result = Result.query.order_by(Result.score.desc()).first() if result: - return result.score + # If we return zero then we're going to have a problem + if result.score > 0: + return result.score + else: + return 1 else: raise LookupError("The database is empty.")