@@ -431,7 +431,7 @@ function isSpace(e: KeyboardEvent) {
431431
432432function handleSpace() {
433433 const metadata = currentMetadata .value ;
434-
434+ metadata . currentWordMetadata . status = getWordStatus ()
435435 insertWord (metadata .currentWord );
436436 pushWordLogs ();
437437 currentWordNum .value += 2 ;
@@ -851,6 +851,7 @@ function setShowResults() {
851851
852852function handleEndWord() {
853853 const metadata = currentMetadata .value ;
854+ metadata .currentWordMetadata .status = getWordStatus ()
854855 if (metadata .currentWordMetadata .type === ' word' ) {
855856 insertWord (metadata .currentWord );
856857 pushWordLogs ();
@@ -905,16 +906,6 @@ function pushWordLogs() {
905906 1000
906907 );
907908 }
908- function getWordStatus(): WordLogStatus {
909- for (let i = 0 ; i < wordLength ; i ++ ) {
910- if (
911- currentMetadata .value .currentWordMetadata
912- .characters [i ].status !== ' correct'
913- )
914- return ' error' ;
915- }
916- return ' correct' ;
917- }
918909 function getWordWpm(): number {
919910 return parseFloat (
920911 (wordLength / 5 / (duration / 60 )).toFixed (2 )
@@ -936,6 +927,18 @@ function pushWordLogs() {
936927 }
937928}
938929
930+ function getWordStatus(): WordLogStatus {
931+ const wordLength = currentMetadata .value .currentWordLength
932+ for (let i = 0 ; i < wordLength ; i ++ ) {
933+ if (
934+ currentMetadata .value .currentWordMetadata
935+ .characters [i ].status !== ' correct'
936+ )
937+ return ' error' ;
938+ }
939+ return ' correct' ;
940+ }
941+
939942function insertWord(word : string ) {
940943 collectedWords .push (word );
941944}
0 commit comments