diff --git a/app.py b/app.py
index 8b31023..fdf2e45 100644
--- a/app.py
+++ b/app.py
@@ -267,6 +267,7 @@ def init_db():
'ALTER TABLE jobs ADD COLUMN client_token TEXT DEFAULT NULL',
'ALTER TABLE jobs ADD COLUMN plate_name TEXT DEFAULT ""',
'ALTER TABLE printers ADD COLUMN ha_entity_prefix TEXT DEFAULT ""',
+ 'ALTER TABLE print_slots ADD COLUMN pieces_ignored INTEGER DEFAULT 0',
]
for sql in migrations:
try:
@@ -1629,6 +1630,7 @@ def api_slots():
slots = conn.execute('''
SELECT ps.id, ps.job_id, ps.printer_id, ps.planned_start, ps.planned_end,
ps.status, ps.failure_note,
+ COALESCE(ps.pieces_ignored, 0) as pieces_ignored,
j.name as job_name, j.print_time_s, j.final_price,
j.pieces_per_plate, j.order_qty, j.weight_g,
j.plate_name,
@@ -1971,6 +1973,9 @@ def _ha_sync_once():
if new_status:
conn.execute('UPDATE print_slots SET status=? WHERE id=?',
(new_status, slot['id']))
+ if ha_ignored > 0:
+ conn.execute('UPDATE print_slots SET pieces_ignored=? WHERE id=?',
+ (ha_ignored, slot['id']))
conn.commit()
conn.close()
except Exception as e:
@@ -2025,15 +2030,21 @@ def api_ha_status():
except: layer = 0
try: layers_total = int(float(gs('nombre_total_de_couches', '0')))
except: layers_total = 0
+ try: pieces_ignored = int(float(gs('objets_ignores', '0')))
+ except: pieces_ignored = 0
+ try: pieces_total = int(float(gs('objets_imprimables', '0')))
+ except: pieces_total = 0
result[str(p['id'])] = {
- 'printer_name': p['name'],
- 'status': gs('etat_de_l_impression'),
- 'progress': progress,
- 'task_name': gs('nom_de_la_tache'),
- 'heure_fin': gs('heure_de_fin'),
- 'layer': layer,
- 'layers_total': layers_total,
- 'error': gb('erreur_d_impression') == 'on',
+ 'printer_name': p['name'],
+ 'status': gs('etat_de_l_impression'),
+ 'progress': progress,
+ 'task_name': gs('nom_de_la_tache'),
+ 'heure_fin': gs('heure_de_fin'),
+ 'layer': layer,
+ 'layers_total': layers_total,
+ 'error': gb('erreur_d_impression') == 'on',
+ 'pieces_ignored': pieces_ignored,
+ 'pieces_total': pieces_total,
}
return jsonify({'printers': result})
except Exception as e:
diff --git a/templates/planning.html b/templates/planning.html
index 89915a0..163a322 100644
--- a/templates/planning.html
+++ b/templates/planning.html
@@ -402,9 +402,12 @@ function renderSlotsList(slots) {
const clientPart = s.client_name
? `
${s.client_name}`
: '';
+ const ignoredPart = (s.pieces_ignored > 0)
+ ? `
${s.pieces_per_plate - s.pieces_ignored}/${s.pieces_per_plate} pièces`
+ : '';
return `