From 2e03fca2dfccba6b144548ff8208045c347d4cf9 Mon Sep 17 00:00:00 2001 From: maziggy Date: Tue, 27 Jan 2026 08:53:48 +0100 Subject: [PATCH] Fix progress milestone notification showing wrong time unit The remaining_time from printer state is in minutes (from mc_remaining_time), but _format_duration() expects seconds. This caused "17h 47m" to display as "17m" in milestone notifications. Closes #157 --- backend/app/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/app/main.py b/backend/app/main.py index a30777354..fa1fc904b 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -437,10 +437,11 @@ async def on_printer_status_change(printer_id: int, state: PrinterState): printer = result.scalar_one_or_none() printer_name = printer.name if printer else f"Printer {printer_id}" filename = state.subtask_name or state.gcode_file or "Unknown" - remaining_time = state.remaining_time + # remaining_time is in minutes, convert to seconds for notification + remaining_time_seconds = state.remaining_time * 60 if state.remaining_time else None await notification_service.on_print_progress( - printer_id, printer_name, filename, current_milestone, db, remaining_time + printer_id, printer_name, filename, current_milestone, db, remaining_time_seconds ) except Exception as e: logging.getLogger(__name__).warning(f"Progress milestone notification failed: {e}")