Skip to content

Commit 28c1ccc

Browse files
committed
fix: partially completed last words not being counted in custom timed mode
1 parent 0ee4b29 commit 28c1ccc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

frontend/src/ts/test/test-stats.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as TestState from "./test-state";
77
import * as Numbers from "@monkeytype/util/numbers";
88
import { CompletedEvent, IncompleteTest } from "@monkeytype/schemas/results";
99
import { isFunboxActiveWithProperty } from "./funbox/list";
10+
import * as CustomText from "./custom-text";
1011

1112
type CharCount = {
1213
spaces: number;
@@ -343,7 +344,11 @@ function countChars(): CharCount {
343344
}
344345
correctChars += toAdd.correct;
345346
incorrectChars += toAdd.incorrect;
346-
if (i === inputWords.length - 1 && Config.mode === "time") {
347+
if (
348+
i === inputWords.length - 1 &&
349+
(Config.mode === "time" ||
350+
(Config.mode === "custom" && CustomText.getLimit().mode === "time"))
351+
) {
347352
//last word - check if it was all correct - add to correct word chars
348353
if (toAdd.incorrect === 0) correctWordChars += toAdd.correct;
349354
} else {

0 commit comments

Comments
 (0)