From d21683fb59a0f215d10d76837e3edcad39f7e1e3 Mon Sep 17 00:00:00 2001 From: alwayscompiling Date: Tue, 12 Jul 2022 16:07:20 -0400 Subject: [PATCH] Only add best score if its new, only delete worse scores if they exist. --- utilities/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utilities/utils.py b/utilities/utils.py index ce657ef..c761791 100644 --- a/utilities/utils.py +++ b/utilities/utils.py @@ -123,10 +123,12 @@ async def submit_score( for index, tup in enumerate(users_scores): if index == 0: # first score is the best score. - scores.append(tup) + if tup not in scores: + scores.append(tup) else: # discard all other scores from scores list. - scores.remove(tup) + if tup in scores: + scores.remove(tup) # sort scores. scores.sort(