avoiding NaN

This commit is contained in:
Miodec 2022-09-17 22:18:58 +02:00
parent 8a78e2b462
commit cb558e291d

View file

@ -1421,7 +1421,9 @@ function buildCompletedEvent(difficultyFailed: boolean): CompletedEvent {
const stddev2 = Misc.stdDev(smoothedraw);
const avg2 = Misc.mean(smoothedraw);
const smoothConsistency = Misc.roundTo2(Misc.kogasa(stddev2 / avg2));
completedEvent.smoothConsistency = smoothConsistency;
completedEvent.smoothConsistency = isNaN(smoothConsistency)
? 0
: smoothConsistency;
//wpm consistency
const stddev3 = Misc.stdDev(completedEvent.chartData.wpm ?? []);