|
|
@@ -253,9 +253,6 @@ _expected_prints: dict[tuple[int, str], int] = {}
|
|
|
# Track starting energy for prints: {archive_id: starting_kwh}
|
|
|
_print_energy_start: dict[int, float] = {}
|
|
|
|
|
|
-# Track reprints to add costs on completion: {archive_id}
|
|
|
-_reprint_archives: set[int] = set()
|
|
|
-
|
|
|
# Track AMS mapping for prints: {archive_id: [global_tray_id_per_slot]}
|
|
|
# Used by usage tracker to map 3MF slots to physical AMS trays
|
|
|
_print_ams_mappings: dict[int, list[int]] = {}
|
|
|
@@ -1270,10 +1267,6 @@ async def on_print_start(printer_id: int, data: dict):
|
|
|
if subtask_name:
|
|
|
_active_prints[(printer_id, f"{subtask_name}.3mf")] = archive.id
|
|
|
|
|
|
- # Mark as reprint so we add cost on completion
|
|
|
- _reprint_archives.add(archive.id)
|
|
|
- logger.info("Marked archive %s as reprint for cost addition on completion", archive.id)
|
|
|
-
|
|
|
# Set up energy tracking
|
|
|
try:
|
|
|
plug_result = await db.execute(select(SmartPlug).where(SmartPlug.printer_id == printer_id))
|
|
|
@@ -2415,15 +2408,6 @@ async def on_print_complete(printer_id: int, data: dict):
|
|
|
"[ARCHIVE] Archive %s status updated to %s, failure_reason=%s", archive_id, status, failure_reason
|
|
|
)
|
|
|
|
|
|
- # Add cost for reprints (first prints have cost set in archive_print())
|
|
|
- if status == "completed" and archive_id in _reprint_archives:
|
|
|
- _reprint_archives.discard(archive_id)
|
|
|
- try:
|
|
|
- await service.add_reprint_cost(archive_id)
|
|
|
- logger.info("[ARCHIVE] Added reprint cost for archive %s", archive_id)
|
|
|
- except Exception as e:
|
|
|
- logger.warning("[ARCHIVE] Failed to add reprint cost for archive %s: %s", archive_id, e)
|
|
|
-
|
|
|
await ws_manager.send_archive_updated(
|
|
|
{
|
|
|
"id": archive_id,
|