Only add best score if its new, only delete worse scores if they exist.

This commit is contained in:
alwayscompiling
2022-07-12 16:07:20 -04:00
parent 44b3d7a80b
commit d21683fb59
+4 -2
View File
@@ -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(