fix(queue): persist selected plate to the archive; reconcile archive on offline stop (#2603)

A print queued from a specific plate of a multi-plate 3MF showed as Plate 1
in Print History after cancellation: the archive derives its plate from the
filename, but a whole multi-plate 3MF uploads under one name with no plate
suffix, so the parser defaulted to plate 1 and nothing copied the queue
item's plate_id onto the archive (which had no plate field).

Add a nullable print_archives.plate_id, copy it from the queue item at
dispatch (archive- and library-file paths), expose it in the archive API,
and render it in Print History. A startup backfill copies the plate onto
existing archives from their linked queue rows. Column add + backfill are
identical on SQLite and Postgres.

Also fix a related lifecycle bug: stopping a printing item while the printer
was offline left the linked archive stuck at "printing" (queue row
cancelled, but no MQTT completion ever arrives to reconcile the archive).
The offline-stop path now closes the archive out directly; the online path
still defers to the MQTT completion event.
This commit is contained in:
maziggy
2026-07-19 09:29:54 +02:00
parent 4a0b14ed0e
commit 83a7b75b14
14 changed files with 381 additions and 3 deletions
+1
View File
@@ -653,6 +653,7 @@ export interface Archive {
original_archive_id: number | null; // ID of the first/original archive
object_count: number | null;
print_name: string | null;
plate_id: number | null; // Selected plate of a multi-plate 3MF (#2603)
print_time_seconds: number | null;
actual_time_seconds: number | null; // Computed from started_at/completed_at
time_accuracy: number | null; // Percentage: 100 = perfect, >100 = faster than estimated