From d88352cc246c75e573706cb3857e81621e283928 Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Tue, 1 Nov 2022 19:52:46 +0100 Subject: [PATCH] fix progress bars rounding instead of flooring for segmented bars. --- frontend/src/lib/components/common/Progress.svelte | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/lib/components/common/Progress.svelte b/frontend/src/lib/components/common/Progress.svelte index 2cd60f7..46b1445 100644 --- a/frontend/src/lib/components/common/Progress.svelte +++ b/frontend/src/lib/components/common/Progress.svelte @@ -69,8 +69,15 @@ nonSegmented = alwaysSmooth || (target >= 60); if (!nonSegmented) { - ons = Math.round(ons); - offs = Math.round(offs); + ons = Math.floor(ons); + offs = Math.ceil(offs); + if (ons + offs > target) { + if (offs > 0) { + offs -= 1; + } else { + ons -= 1; + } + } } } else { offClass = "none";