Skip to content

Commit 8a3fa87

Browse files
committed
fix(practice slow words): too many words being passed into practice mode in timed tests
1 parent 01d8363 commit 8a3fa87

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

frontend/src/ts/test/practise-words.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,20 @@ export function init(
8383

8484
let sortableSlowWords: [string, number][] = [];
8585
if (slow) {
86-
sortableSlowWords = TestWords.words
86+
const typedWords = TestWords.words
8787
.get()
88-
.map((e, i) => [e, TestInput.burstHistory[i] ?? 0]);
88+
.slice(0, TestInput.input.getHistory().length - 1);
89+
90+
sortableSlowWords = typedWords.map((e, i) => [
91+
e,
92+
TestInput.burstHistory[i] ?? 0,
93+
]);
8994
sortableSlowWords.sort((a, b) => {
9095
return a[1] - b[1];
9196
});
9297
sortableSlowWords = sortableSlowWords.slice(
9398
0,
94-
Math.min(limit, Math.round(TestWords.words.length * 0.2))
99+
Math.min(limit, Math.round(typedWords.length * 0.2))
95100
);
96101
if (sortableSlowWords.length === 0) {
97102
Notifications.add("Test too short to classify slow words.", 0);

0 commit comments

Comments
 (0)