From dc4e7597b8cf662802651f449f27efb4ec6fd15a Mon Sep 17 00:00:00 2001 From: Mawoka Date: Fri, 7 Oct 2022 13:22:25 +0200 Subject: [PATCH] :sparkles: Added total question-count to live/get_question/now-endpoint --- classquiz/routers/live.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/classquiz/routers/live.py b/classquiz/routers/live.py index 9b788cf..03440a1 100644 --- a/classquiz/routers/live.py +++ b/classquiz/routers/live.py @@ -243,10 +243,16 @@ async def too_stupid_to_come_up_with_a_name(game_pin: str, api_key: str, in_huma ) if game.current_question >= 0: game.current_question += 1 - return [{**game.questions[game.current_question].dict(), "current_question": game.current_question}] + return [ + { + **game.questions[game.current_question].dict(), + "current_question": game.current_question, + "total_questions": len(game.questions), + } + ] else: game.current_question += 1 - return [{"question": {}, "current_question": game.current_question}] + return [{"question": {}, "current_question": game.current_question, "total_questions": len(game.questions)}] @router.get("/voting")