mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-24 14:54:20 +08:00
added bailed out test too short validation
This commit is contained in:
parent
f6c10e656b
commit
8a78e2b462
1 changed files with 18 additions and 4 deletions
|
@ -56,18 +56,24 @@ export function isTagPresetNameValid(name: string): boolean {
|
|||
}
|
||||
|
||||
export function isTestTooShort(result: MonkeyTypes.CompletedEvent): boolean {
|
||||
const { mode, mode2, customText, testDuration } = result;
|
||||
const { mode, mode2, customText, testDuration, bailedOut } = result;
|
||||
|
||||
if (mode === "time") {
|
||||
const setTimeTooShort = mode2 > 0 && mode2 < 15;
|
||||
const infiniteTimeTooShort = mode2 === 0 && testDuration < 15;
|
||||
return setTimeTooShort || infiniteTimeTooShort;
|
||||
const bailedOutTooShort = bailedOut
|
||||
? bailedOut && testDuration < 15
|
||||
: false;
|
||||
return setTimeTooShort || infiniteTimeTooShort || bailedOutTooShort;
|
||||
}
|
||||
|
||||
if (mode === "words") {
|
||||
const setWordTooShort = mode2 > 0 && mode2 < 10;
|
||||
const infiniteWordTooShort = mode2 === 0 && testDuration < 15;
|
||||
return setWordTooShort || infiniteWordTooShort;
|
||||
const bailedOutTooShort = bailedOut
|
||||
? bailedOut && testDuration < 15
|
||||
: false;
|
||||
return setWordTooShort || infiniteWordTooShort || bailedOutTooShort;
|
||||
}
|
||||
|
||||
if (mode === "custom") {
|
||||
|
@ -77,7 +83,15 @@ export function isTestTooShort(result: MonkeyTypes.CompletedEvent): boolean {
|
|||
!isWordRandom && !isTimeRandom && _.isNumber(textLen) && textLen < 10;
|
||||
const randomWordsTooShort = isWordRandom && !isTimeRandom && word < 10;
|
||||
const randomTimeTooShort = !isWordRandom && isTimeRandom && time < 15;
|
||||
return setTextTooShort || randomWordsTooShort || randomTimeTooShort;
|
||||
const bailedOutTooShort = bailedOut
|
||||
? bailedOut && testDuration < 15
|
||||
: false;
|
||||
return (
|
||||
setTextTooShort ||
|
||||
randomWordsTooShort ||
|
||||
randomTimeTooShort ||
|
||||
bailedOutTooShort
|
||||
);
|
||||
}
|
||||
|
||||
if (mode === "zen") {
|
||||
|
|
Loading…
Reference in a new issue