mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-28 01:39:29 +08:00
fixed incorrect keyconsistency calculation
This commit is contained in:
parent
cb215ef521
commit
f91c749c18
1 changed files with 11 additions and 4 deletions
|
|
@ -1251,19 +1251,26 @@ function buildCompletedEvent(difficultyFailed: boolean): CompletedEvent {
|
|||
const stddev = Misc.stdDev(rawPerSecond);
|
||||
const avg = Misc.mean(rawPerSecond);
|
||||
let consistency = Misc.roundTo2(Misc.kogasa(stddev / avg));
|
||||
const keyConsistencyArray =
|
||||
let keyConsistencyArray =
|
||||
TestInput.keypressTimings.spacing.array === "toolong"
|
||||
? []
|
||||
: TestInput.keypressTimings.spacing.array.slice();
|
||||
keyConsistencyArray.splice(0, keyConsistencyArray.length - 1);
|
||||
const keyConsistency = Misc.roundTo2(
|
||||
if (keyConsistencyArray.length > 0)
|
||||
keyConsistencyArray = keyConsistencyArray.slice(
|
||||
0,
|
||||
keyConsistencyArray.length - 1
|
||||
);
|
||||
let keyConsistency = Misc.roundTo2(
|
||||
Misc.kogasa(
|
||||
Misc.stdDev(keyConsistencyArray) / Misc.mean(keyConsistencyArray)
|
||||
)
|
||||
);
|
||||
if (isNaN(consistency)) {
|
||||
if (!consistency || isNaN(consistency)) {
|
||||
consistency = 0;
|
||||
}
|
||||
if (!keyConsistency || isNaN(keyConsistency)) {
|
||||
keyConsistency = 0;
|
||||
}
|
||||
completedEvent.keyConsistency = keyConsistency;
|
||||
completedEvent.consistency = consistency;
|
||||
const smoothedraw = Misc.smooth(rawPerSecond, 1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue