diff --git a/.last-branch b/.last-branch index 7f55fc8..2fa57f9 100644 --- a/.last-branch +++ b/.last-branch @@ -1 +1 @@ -v20260103-13-reports-edit-and-view-raw-fix +v20260103-14-reports-percentage-2-decimals diff --git a/containers/backupchecks/src/backend/app/main/routes_reporting_api.py b/containers/backupchecks/src/backend/app/main/routes_reporting_api.py index 73428ee..ef86bb9 100644 --- a/containers/backupchecks/src/backend/app/main/routes_reporting_api.py +++ b/containers/backupchecks/src/backend/app/main/routes_reporting_api.py @@ -532,7 +532,7 @@ def api_reports_data(report_id: int): "warning_count": int(r.warning_count or 0), "failed_count": int(r.failed_count or 0), "missed_count": int(r.missed_count or 0), - "success_rate": float(r.success_rate or 0.0), + "success_rate": round(round(float(r.success_rate or 0.0), 2), 2), } for r in rows ], @@ -636,6 +636,7 @@ def api_reports_stats(report_id: int): if total_runs > 0: success_rate = ((success_runs + success_override_runs) / float(total_runs)) * 100.0 + success_rate = round(success_rate, 2) # Status distribution (for donut/pie) status_distribution = [ {"key": "success", "value": success_runs + success_override_runs}, @@ -677,7 +678,7 @@ def api_reports_stats(report_id: int): trends.append( { "day": tr.day.isoformat() if tr.day else "", - "success_rate": day_rate, + "success_rate": round(day_rate, 2), "failed_runs": int(tr.failed_runs or 0), "warning_runs": int(tr.warning_runs or 0), "missed_runs": int(tr.missed_runs or 0), @@ -754,7 +755,7 @@ def api_reports_export_csv(report_id: int): int(r.warning_count or 0), int(r.failed_count or 0), int(r.missed_count or 0), - float(r.success_rate or 0.0), + round(float(r.success_rate or 0.0), 2), ]) filename = f"report-{report_id}-summary.csv" else: diff --git a/docs/changelog.md b/docs/changelog.md index 7432833..e85b50a 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -117,6 +117,17 @@ - Resolved an HTML rendering issue causing an extra ">" character above the Name column. - Improved the reports list to correctly display the report type instead of incorrect metadata. +--- + +## v20260103-14-reports-percentage-2-decimals + +- Limited percentage values in reports to a maximum of two decimal places. +- Applied consistent rounding for percentage fields across: + - Report summary views + - KPI and trend data outputs + - CSV export generation +- Improved readability and consistency of reported percentage values. + ================================================================================================================================================ ## v0.1.15