From 52ccc5b85e34c0317190ea70e83ba4ef9f2d2497 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Sun, 12 Jun 2022 20:55:10 +0100 Subject: [PATCH] fix: dont save h32/256 if less than 100bpm --- .../calculated-data/calculated-data.ts | 41 +++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/server/src/lib/score-import/framework/calculated-data/calculated-data.ts b/server/src/lib/score-import/framework/calculated-data/calculated-data.ts index 8130ee411..10590d541 100644 --- a/server/src/lib/score-import/framework/calculated-data/calculated-data.ts +++ b/server/src/lib/score-import/framework/calculated-data/calculated-data.ts @@ -256,19 +256,36 @@ function CalculateDataITGStamina( }; } + let h32 = ITGHighestUnbroken.calculateFromNPSPerMeasure( + chart.data.breakdown.npsPerMeasure, + chart.data.breakdown.notesPerMeasure, + dryScore.scoreData.hitMeta.diedAt, + 32 + ); + + let h256 = ITGHighestUnbroken.calculateFromNPSPerMeasure( + chart.data.breakdown.npsPerMeasure, + chart.data.breakdown.notesPerMeasure, + dryScore.scoreData.hitMeta.diedAt, + 256 + ); + + // To avoid confusing players, we reject highest 32s less than + // 100bpm. Due to how highest32 is calculated, it correctly comes + // to the conclusion that sometimes you technically just hit 32 unbroken + // measures at like 14 BPM. This is confusing to end users, so we should + // hide it. + if (h32 !== null && h32 < 100) { + h32 = null; + } + + if (h256 !== null && h256 < 100) { + h256 = null; + } + return { blockRating: chart.levelNum, - highest32: ITGHighestUnbroken.calculateFromNPSPerMeasure( - chart.data.breakdown.npsPerMeasure, - chart.data.breakdown.notesPerMeasure, - dryScore.scoreData.hitMeta.diedAt, - 32 - ), - highest256: ITGHighestUnbroken.calculateFromNPSPerMeasure( - chart.data.breakdown.npsPerMeasure, - chart.data.breakdown.notesPerMeasure, - dryScore.scoreData.hitMeta.diedAt, - 256 - ), + highest32: h32, + highest256: h256, }; }