From 4dd91ad03cc9bc335f0a4692ed4e971e5bb20180 Mon Sep 17 00:00:00 2001 From: ashastral Date: Wed, 2 Mar 2022 19:19:22 -0800 Subject: [PATCH] update stats on loss, not on reset --- web-optimle/www/src/Game.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web-optimle/www/src/Game.tsx b/web-optimle/www/src/Game.tsx index 9b82637..e96609e 100644 --- a/web-optimle/www/src/Game.tsx +++ b/web-optimle/www/src/Game.tsx @@ -61,10 +61,6 @@ export function Game(props: GameProps) { setGuesses([...puzzle.history]); setCurrentGuess(""); setGameState(GameState.Playing); - setTodayStats((oldStats) => ({ - ...oldStats, - tries: oldStats.tries + 1, - })); }, []); useEffect(() => { @@ -181,6 +177,10 @@ export function Game(props: GameProps) { } else if (guesses.length + 1 === puzzle.history.length + MAX_GUESSES) { setHint(

Not quite! The answer could've been {game.possible_word().toUpperCase()}. (Enter to try again)

); setGameState(GameState.Lost); + setTodayStats((oldStats) => ({ + ...oldStats, + tries: oldStats.tries + 1, + })); } else { speak(describeClue(clue(result))); }