From 5995cd3ab73ccd13a5a2d4bf83c5d7e8f86d5615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Tue, 4 Aug 2026 17:31:31 +0000 Subject: [PATCH] transmission: floor progress percentages instead of rounding 99.97% printed as "100.0%" beside a still-blue bar, which reads as a stuck torrent. only a genuinely complete fraction shows a hundred now, as "100%". Co-Authored-By: Claude Opus 5 --- src/workspaces/officerdev/src/apps/Transmission/format.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/workspaces/officerdev/src/apps/Transmission/format.ts b/src/workspaces/officerdev/src/apps/Transmission/format.ts index 4cd20d93..abd67d3d 100644 --- a/src/workspaces/officerdev/src/apps/Transmission/format.ts +++ b/src/workspaces/officerdev/src/apps/Transmission/format.ts @@ -61,9 +61,15 @@ export function formatDate(unixSeconds: number | undefined | null): string { return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`; } +/** + * Progress, floored — never rounded. `toFixed` rounds, so 99.97% printed as "100.0%" next to a bar that + * is still blue, which reads as a stuck torrent rather than a nearly-finished one. Only an actually + * complete fraction may show a hundred, and it shows it as a flat "100%" so the two can't be confused. + */ export function formatPercent(fraction: number | undefined | null): string { if (fraction == null) return '—'; - return `${(fraction * 100).toFixed(1)}%`; + if (fraction >= 1) return '100%'; + return `${(Math.floor(fraction * 1000) / 10).toFixed(1)}%`; } // ── Status ────────────────────────────────────────────────────────────────────────────────────────