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 ────────────────────────────────────────────────────────────────────────────────────────