passing extra datas in gameStats
This commit is contained in:
parent
f92e58c36a
commit
636d9c9033
|
|
@ -66,7 +66,6 @@ export function GameContextProvider({ children }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function endGame() {
|
function endGame() {
|
||||||
console.log("### Edning Game is complete");
|
|
||||||
setIsTimeRuning(false);
|
setIsTimeRuning(false);
|
||||||
setIsGameComplete(true);
|
setIsGameComplete(true);
|
||||||
const gameStats = buildGameStatsObject();
|
const gameStats = buildGameStatsObject();
|
||||||
|
|
@ -82,6 +81,13 @@ export function GameContextProvider({ children }) {
|
||||||
user_country: country.name,
|
user_country: country.name,
|
||||||
level_post_id: contextGameDatas.gameId ?? null,
|
level_post_id: contextGameDatas.gameId ?? null,
|
||||||
level_score: score ?? 0,
|
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,
|
level_completion_time: gameTime,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user