Keep the printer's name on statistics after it is deleted (issue #2873)

Every per-printer breakdown resolved the name against the printers that
exist now, so deleting a printer and choosing to keep its prints turned
"Ultron" into "Printer 1" in Prints by Printer, the success-rate and
time-accuracy lists, and Failures by Printer. Archives lose their printer
on that delete as well, so nothing was left to read a name from.

The runs themselves recorded the name they printed on. /archives/stats now
reports the last name each id was known by - taken from the newest run that
has one, so a later name-less row cannot blank it - and failure analysis
falls back to the same thing for ids with no printer left. The client keeps
preferring a live printer's own record, so a rename still shows up straight
away rather than after the next print.
This commit is contained in:
maziggy
2026-08-18 14:04:18 +02:00
parent cfecfa360e
commit 28781ea558
10 changed files with 221 additions and 4 deletions
+3
View File
@@ -813,6 +813,9 @@ export interface ArchiveStats {
total_cost: number;
prints_by_filament_type: Record<string, number>;
prints_by_printer: Record<string, number>;
// Name each printer id was last recorded under in the print log, so history
// belonging to a deleted printer keeps its label.
printer_names?: Record<string, string>;
average_time_accuracy: number | null;
time_accuracy_by_printer: Record<string, number> | null;
total_energy_kwh: number;