fixed incorrect keyconsistency calculation

This commit is contained in:
Miodec 2022-02-28 22:30:57 +01:00
parent cb215ef521
commit f91c749c18

View file

@ -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);