fixed the 420 words 10 unlock not working

This commit is contained in:
Miodec 2023-02-23 19:27:05 +01:00
parent 8399cbab11
commit b5a08bd96e
2 changed files with 19 additions and 3 deletions

View file

@ -592,10 +592,18 @@ function updateOther(
if (TestStats.invalid) {
otherText += "<br>invalid";
const extra: string[] = [];
if (result.wpm < 0 || result.wpm > 350) {
if (
result.wpm < 0 ||
(result.wpm > 350 && result.mode != "words" && result.mode2 != "10") ||
(result.wpm > 420 && result.mode == "words" && result.mode2 == "10")
) {
extra.push("wpm");
}
if (result.rawWpm < 0 || result.rawWpm > 350) {
if (
result.rawWpm < 0 ||
(result.rawWpm > 350 && result.mode != "words" && result.mode2 != "10") ||
(result.rawWpm > 420 && result.mode == "words" && result.mode2 == "10")
) {
extra.push("raw");
}
if (result.acc < 75 || result.acc > 100) {

View file

@ -1596,7 +1596,15 @@ export async function finish(difficultyFailed = false): Promise<void> {
Notifications.add("Test invalid - too short", 0);
tooShort = true;
dontSave = true;
} else if (completedEvent.wpm < 0 || completedEvent.wpm > 350) {
} else if (
completedEvent.wpm < 0 ||
(completedEvent.wpm > 350 &&
completedEvent.mode != "words" &&
completedEvent.mode2 != "10") ||
(completedEvent.wpm > 420 &&
completedEvent.mode == "words" &&
completedEvent.mode2 == "10")
) {
Notifications.add("Test invalid - wpm", 0);
TestStats.setInvalid();
dontSave = true;