Fixing get_highest_score zero division

This commit is contained in:
Denis-Cosmin Nutiu 2017-04-22 01:40:03 +03:00
parent 6bebaaa9b9
commit 8b7698c9f4

View file

@ -90,7 +90,11 @@ def get_highest_score():
"""
result = Result.query.order_by(Result.score.desc()).first()
if result:
# 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.")