Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/ts/test/test-logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ function compareCompletedEvents(
difficulty: ce.difficulty,
duration: ce.testDuration,
funboxes: getActiveFunboxNames().join(","),
version: 16,
version: 17,
data: {
words: TestWords.words.list.join(" "),
events: getAllTestEvents(),
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/ts/test/test-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,16 @@ function countChars(final = false): CharCount {

for (let i = 0; i < inputWords.length; i++) {
const inputWord = inputWords[i] as string;
const targetWord = targetWords[i] as string;
let targetWord = targetWords[i] as string;
const isLastInputWord = i === inputWords.length - 1;

// getTargetWords appends a delimiter to every word except the last in the
// generated list; for the last input word (active in timed/mid-test, or
// the actual last word) drop that delimiter so overshoot counts as extra
if (isLastInputWord && targetWord.endsWith(" ")) {
targetWord = targetWord.slice(0, -1);
}

const { correctWord, allCorrect, incorrect, missed, extra } =
countCharsUtils(
inputWord,
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const ReportCompletedEventMismatchRequestSchema = z.object({
difficulty: DifficultySchema.optional(),
duration: z.number().max(200).optional(),
funboxes: z.string().max(100).optional(),
version: z.literal(16),
version: z.literal(17),
data: z.object({
words: z.string().max(10000),
events: z.array(z.record(z.unknown())),
Expand Down
Loading