Add a wear cost per printing hour to printers (#694)

Print costs covered filament and energy but not the printer. Each printer
can now carry an optional wear cost per printing hour. Every run's wear is
its logged duration at that rate, stored on the print log entry; the
archive keeps the first run's wear, like energy (#1378). Failed and
cancelled runs count, reconciled runs (unknown duration) don't, and a rate
applies to new prints only.

Wear is shown on the archive card, as a hidden sortable Print Log column,
as a Quick Stats tile, in the most expensive record, in project totals and
in batch order cost, and is kept by GitHub backup and restore. Billing
still charges filament only.

New nullable columns: printers.wear_cost_per_hour, print_log_entries.wear_cost
and print_archives.wear_cost.
This commit is contained in:
maziggy
2026-10-05 09:29:12 +02:00
parent cdb78f1321
commit 6c8a821bca
48 changed files with 658 additions and 40 deletions
+1
View File
@@ -880,6 +880,7 @@ class GitHubBackupService:
"quantity": a.quantity,
"energy_kwh": a.energy_kwh,
"energy_cost": a.energy_cost,
"wear_cost": a.wear_cost,
"created_at": str(a.created_at) if a.created_at else None,
# Soft-deleted archives are collected too — their row is kept on
# purpose so the stats endpoint keeps counting their filament and