From cf1e67cd9c31e2b30489cc294a20901834788f65 Mon Sep 17 00:00:00 2001 From: Mattia Migliorini Date: Fri, 9 Jan 2026 19:46:46 +0100 Subject: [PATCH] Fix team stats owned percentage 100% (#2838) Resolves #2837 ## Description: This PR aligns the "Owned" percentage format in TeamStats to the same data in Leaderboard, fixing the issue that currently happens when team reaches 100%, and the percentage is displayed as "1.0e+2%". Previous implementation to avoid this problem involved checking for the "100" value, but we all know how floating point arithmetic works in JS... Before: image After: image ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: deshack_82603 --- src/client/graphics/layers/TeamStats.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/client/graphics/layers/TeamStats.ts b/src/client/graphics/layers/TeamStats.ts index edbd881cd..8e0babec9 100644 --- a/src/client/graphics/layers/TeamStats.ts +++ b/src/client/graphics/layers/TeamStats.ts @@ -247,6 +247,5 @@ export class TeamStats extends LitElement implements Layer { function formatPercentage(value: number): string { const perc = value * 100; if (Number.isNaN(perc)) return "0%"; - if (perc === 100) return "100%"; - return perc.toPrecision(2) + "%"; + return perc.toFixed(1) + "%"; }