Fixing get_highest_score zero division
This commit is contained in:
parent
6bebaaa9b9
commit
8b7698c9f4
1 changed files with 5 additions and 1 deletions
|
@ -90,7 +90,11 @@ def get_highest_score():
|
||||||
"""
|
"""
|
||||||
result = Result.query.order_by(Result.score.desc()).first()
|
result = Result.query.order_by(Result.score.desc()).first()
|
||||||
if result:
|
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:
|
else:
|
||||||
raise LookupError("The database is empty.")
|
raise LookupError("The database is empty.")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue