From fa7e4774e5e6ad51091076753af0330bd9ece4ba Mon Sep 17 00:00:00 2001 From: Mawoka Date: Sun, 25 Sep 2022 21:38:05 +0200 Subject: [PATCH] :sparkles: Endpoint for live player-scores (new) --- classquiz/routers/quiz.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classquiz/routers/quiz.py b/classquiz/routers/quiz.py index 8bde33c..1c5c171 100644 --- a/classquiz/routers/quiz.py +++ b/classquiz/routers/quiz.py @@ -353,4 +353,7 @@ async def set_next_question(game_pin: int, question_number: int, api_key: str): @router.get("/live/scores", tags=["live"]) async def get_live_player_scores(game_pin: int): res = await redis.hgetall(f"game_session:{game_pin}:player_scores") - return res + return_arr = [] + for username in res: + return_arr.append({"useranme": username, "score": res[username]}) + return return_arr