File tree Expand file tree Collapse file tree
frontend/src/ts/controllers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -234,11 +234,6 @@ function handleSpace(): void {
234234 void Sound . playClick ( ) ;
235235 }
236236 Replay . addReplayEvent ( "submitCorrectWord" ) ;
237- if ( TestWords . words . currentIndex === TestWords . words . length ) {
238- //submitted last word (checking this in case the test doesnt stop automatically on correct last keypress)
239- void TestLogic . finish ( ) ;
240- return ;
241- }
242237 } else {
243238 if ( ! nospace ) {
244239 if ( Config . playSoundOnError === "off" || Config . blindMode ) {
@@ -284,15 +279,22 @@ function handleSpace(): void {
284279 void Caret . updatePosition ( ) ;
285280 TestInput . incrementKeypressCount ( ) ;
286281 TestInput . pushKeypressWord ( TestWords . words . currentIndex ) ;
287- if ( Config . difficulty === "expert" || Config . difficulty === "master" ) {
282+ Replay . addReplayEvent ( "submitErrorWord" ) ;
283+ }
284+
285+ if (
286+ TestLogic . areAllTestWordsGenerated ( ) &&
287+ TestWords . words . currentIndex === TestWords . words . length
288+ ) {
289+ if (
290+ ! isWordCorrect &&
291+ ( Config . difficulty === "expert" || Config . difficulty === "master" )
292+ ) {
288293 TestLogic . fail ( "difficulty" ) ;
289- return ;
290- } else if ( TestWords . words . currentIndex === TestWords . words . length ) {
291- //submitted last word that is incorrect
294+ } else {
292295 void TestLogic . finish ( ) ;
293- return ;
294296 }
295- Replay . addReplayEvent ( "submitErrorWord" ) ;
297+ return ;
296298 }
297299
298300 let wordLength : number ;
You can’t perform that action at this time.
0 commit comments