From 636d9c9033fc71f34ca06f792ebf025334e8bcd2 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Tue, 7 May 2024 11:49:46 +0200 Subject: [PATCH] passing extra datas in gameStats --- src/context/GameContext.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/context/GameContext.js b/src/context/GameContext.js index f314052..899fe97 100644 --- a/src/context/GameContext.js +++ b/src/context/GameContext.js @@ -66,7 +66,6 @@ export function GameContextProvider({ children }) { } function endGame() { - console.log("### Edning Game is complete"); setIsTimeRuning(false); setIsGameComplete(true); const gameStats = buildGameStatsObject(); @@ -82,6 +81,13 @@ export function GameContextProvider({ children }) { user_country: country.name, level_post_id: contextGameDatas.gameId ?? null, level_score: score ?? 0, + level_total_questions: answers.length, + level_score_range: + score === answers.length + ? "perfect" + : score >= answers.length / 2 + ? "congrats" + : "attention", level_completion_time: gameTime, }; }