Handling situation with no solves

selenium-screenshot-testing
Kevin Chung 2016-10-25 22:41:31 -04:00
parent 3f596d87b1
commit f4fec18f44
1 changed files with 5 additions and 2 deletions

View File

@ -740,8 +740,11 @@ def admin_stats():
for chal, count, name in solves: for chal, count, name in solves:
solve_data[name] = count solve_data[name] = count
most_solved = max(solve_data, key=solve_data.get) most_solved = None
least_solved = min(solve_data, key=solve_data.get) least_solved = None
if len(solve_data):
most_solved = max(solve_data, key=solve_data.get)
least_solved = min(solve_data, key=solve_data.get)
db.session.expunge_all() db.session.expunge_all()
db.session.commit() db.session.commit()