mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-27 16:24:41 +08:00
moved the code responsible for removing trailing afk from bailed out tests to the test finish function
This commit is contained in:
parent
7633155336
commit
73d2db4799
2 changed files with 6 additions and 5 deletions
|
@ -1555,6 +1555,11 @@ export async function finish(difficultyFailed = false): Promise<void> {
|
|||
|
||||
TestInput.forceKeyup(now); //this ensures that the last keypress(es) are registered
|
||||
|
||||
const endAfkSeconds = (now - TestInput.keypressTimings.spacing.last) / 1000;
|
||||
if ((Config.mode == "zen" || TestInput.bailout) && endAfkSeconds < 7) {
|
||||
TestStats.setEnd(TestInput.keypressTimings.spacing.last);
|
||||
}
|
||||
|
||||
TestUI.setResultCalculating(true);
|
||||
TestUI.setResultVisible(true);
|
||||
TestState.setActive(false);
|
||||
|
|
|
@ -186,16 +186,12 @@ export function setInvalid(): void {
|
|||
|
||||
export function calculateTestSeconds(now?: number): number {
|
||||
if (now === undefined) {
|
||||
const endAfkSeconds = (end - TestInput.lastKeypress) / 1000;
|
||||
if ((Config.mode == "zen" || TestInput.bailout) && endAfkSeconds < 7) {
|
||||
return (TestInput.lastKeypress - start) / 1000;
|
||||
} else {
|
||||
return (end - start) / 1000;
|
||||
}
|
||||
} else {
|
||||
return (now - start) / 1000;
|
||||
}
|
||||
}
|
||||
|
||||
let avg = 0;
|
||||
export function calculateWpmAndRaw(): MonkeyTypes.WordsPerMinuteAndRaw {
|
||||
const start = performance.now();
|
||||
|
|
Loading…
Reference in a new issue