Only add best score if its new, only delete worse scores if they exist.
This commit is contained in:
+4
-2
@@ -123,10 +123,12 @@ async def submit_score(
|
|||||||
for index, tup in enumerate(users_scores):
|
for index, tup in enumerate(users_scores):
|
||||||
if index == 0:
|
if index == 0:
|
||||||
# first score is the best score.
|
# first score is the best score.
|
||||||
scores.append(tup)
|
if tup not in scores:
|
||||||
|
scores.append(tup)
|
||||||
else:
|
else:
|
||||||
# discard all other scores from scores list.
|
# discard all other scores from scores list.
|
||||||
scores.remove(tup)
|
if tup in scores:
|
||||||
|
scores.remove(tup)
|
||||||
|
|
||||||
# sort scores.
|
# sort scores.
|
||||||
scores.sort(
|
scores.sort(
|
||||||
|
|||||||
Reference in New Issue
Block a user