From b2603c8c2d968b0a6577bd920c092758733f97b3 Mon Sep 17 00:00:00 2001 From: AneoPsy Date: Sat, 28 Feb 2026 00:54:56 -1000 Subject: [PATCH] fix(stats): calculate success rate from completed and failed prints only Previously divided successful prints by total_prints which includes cancelled/stopped prints, causing an incorrect percentage. --- frontend/src/pages/StatsPage.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/StatsPage.tsx b/frontend/src/pages/StatsPage.tsx index 9a88c0fe8..018e8e7e5 100644 --- a/frontend/src/pages/StatsPage.tsx +++ b/frontend/src/pages/StatsPage.tsx @@ -123,8 +123,9 @@ function SuccessRateWidget({ size?: 1 | 2 | 4; t: (key: string) => string; }) { - const successRate = stats?.total_prints - ? Math.round((stats.successful_prints / stats.total_prints) * 100) + const completedAndFailed = (stats?.successful_prints || 0) + (stats?.failed_prints || 0); + const successRate = completedAndFailed + ? Math.round((stats!.successful_prints / completedAndFailed) * 100) : 0; // Scale gauge size based on widget size