mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 03:01:21 +02:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user