mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-23 01:50:14 +08:00
fix: wpm sometimes goes negative in zen mode
kind of a band aid fix but its ok closes #7099
This commit is contained in:
parent
33880b3842
commit
8aa1f51c2c
1 changed files with 11 additions and 4 deletions
|
|
@ -138,11 +138,18 @@ export function setInvalid(): void {
|
|||
}
|
||||
|
||||
export function calculateTestSeconds(now?: number): number {
|
||||
if (now === undefined) {
|
||||
return (end - start) / 1000;
|
||||
} else {
|
||||
return (now - start) / 1000;
|
||||
let duration = (end - start) / 1000;
|
||||
|
||||
if (now !== undefined) {
|
||||
duration = (now - start) / 1000;
|
||||
}
|
||||
|
||||
if (Config.mode === "zen" && duration < 0) {
|
||||
duration = 0;
|
||||
console.log("Zen mode with negative duration detected, setting to 0");
|
||||
}
|
||||
|
||||
return duration;
|
||||
}
|
||||
|
||||
export function calculateWpmAndRaw(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue