fixed accouracy being rounded in some places instead of floored

closes #3683
This commit is contained in:
Miodec 2022-10-26 19:12:41 +02:00
parent a6a7454d2e
commit 5ebd050e9c
2 changed files with 5 additions and 7 deletions

View file

@ -18,12 +18,10 @@ export async function update(): Promise<void> {
Config.difficulty,
Config.lazyMode
)
)
.map(Misc.roundTo2)
.map((num) => (Config.alwaysShowDecimalPlaces ? Math.round(num) : num));
).map(Misc.roundTo2);
averageWPM = wpm;
averageAcc = acc;
averageWPM = Config.alwaysShowDecimalPlaces ? wpm : Math.round(wpm);
averageAcc = Config.alwaysShowDecimalPlaces ? acc : Math.floor(acc);
}
export function getWPM(): number {

View file

@ -878,7 +878,7 @@ function fillContent(): void {
let averageAcc: number | string = totalAcc;
if (Config.alwaysShowDecimalPlaces) {
averageAcc = Misc.roundTo2(averageAcc / testCount).toFixed(2);
averageAcc = Math.floor(averageAcc / testCount).toFixed(2);
} else {
averageAcc = Math.round(averageAcc / testCount);
}
@ -887,7 +887,7 @@ function fillContent(): void {
let averageAccLast10: number | string = totalAcc10;
if (Config.alwaysShowDecimalPlaces) {
averageAccLast10 = Misc.roundTo2(averageAccLast10 / last10).toFixed(2);
averageAccLast10 = Math.floor(averageAccLast10 / last10).toFixed(2);
} else {
averageAccLast10 = Math.round(averageAccLast10 / last10);
}