From c3b97169b2979f894e491c9278167d86cccb4981 Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 22 May 2023 20:02:43 +0200 Subject: [PATCH] fixed accuracy accuracy being rounded incorrectly when always show decimal places is enabled --- frontend/src/ts/pages/account.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/ts/pages/account.ts b/frontend/src/ts/pages/account.ts index a0eb0563a..c39649b49 100644 --- a/frontend/src/ts/pages/account.ts +++ b/frontend/src/ts/pages/account.ts @@ -930,25 +930,25 @@ function fillContent(): void { if (Config.alwaysShowDecimalPlaces) { highestAcc = Misc.roundTo2(highestAcc).toFixed(2); } else { - highestAcc = Math.round(highestAcc); + highestAcc = Math.floor(highestAcc); } $(".pageAccount .highestAcc .val").text(highestAcc + "%"); let averageAcc: number | string = totalAcc; if (Config.alwaysShowDecimalPlaces) { - averageAcc = Math.floor(averageAcc / testCount).toFixed(2); + averageAcc = Misc.roundTo2(averageAcc / testCount); } else { - averageAcc = Math.round(averageAcc / testCount); + averageAcc = Math.floor(averageAcc / testCount); } $(".pageAccount .avgAcc .val").text(averageAcc + "%"); let averageAccLast10: number | string = totalAcc10; if (Config.alwaysShowDecimalPlaces) { - averageAccLast10 = Math.floor(averageAccLast10 / last10).toFixed(2); + averageAccLast10 = Misc.roundTo2(averageAccLast10 / last10); } else { - averageAccLast10 = Math.round(averageAccLast10 / last10); + averageAccLast10 = Math.floor(averageAccLast10 / last10); } $(".pageAccount .avgAcc10 .val").text(averageAccLast10 + "%");