Endpoint for live player-scores now sorted

This commit is contained in:
Mawoka
2022-09-25 21:50:09 +02:00
parent fa7e4774e5
commit 489d5c96d6
+2 -1
View File
@@ -355,5 +355,6 @@ async def get_live_player_scores(game_pin: int):
res = await redis.hgetall(f"game_session:{game_pin}:player_scores")
return_arr = []
for username in res:
return_arr.append({"useranme": username, "score": res[username]})
return_arr.append({"username": username, "score": int(res[username])})
return_arr = sorted(return_arr, key=lambda d: d["score"], reverse=True)
return return_arr