fix: show multi-plate jobs in À planifier until all plateaux are scheduled
Deploy via Portainer / deploy (push) Successful in 0s
Deploy via Portainer / deploy (push) Successful in 0s
This commit is contained in:
@@ -1324,9 +1324,18 @@ def planning():
|
||||
conn = get_db()
|
||||
printers = [dict(r) for r in conn.execute('SELECT * FROM printers ORDER BY id').fetchall()]
|
||||
unscheduled = conn.execute('''
|
||||
SELECT j.*, c.name as client_name
|
||||
SELECT j.*, c.name as client_name,
|
||||
COALESCE((SELECT COUNT(*) FROM print_slots ps
|
||||
WHERE ps.job_id=j.id
|
||||
AND ps.status NOT IN ('cancelled','failed')), 0) as scheduled_plates,
|
||||
(COALESCE(j.order_qty,1) + COALESCE(j.pieces_per_plate,1) - 1)
|
||||
/ COALESCE(j.pieces_per_plate,1) as total_plates_needed
|
||||
FROM jobs j LEFT JOIN clients c ON j.client_id=c.id
|
||||
WHERE j.id NOT IN (SELECT DISTINCT job_id FROM print_slots WHERE status NOT IN ('cancelled','failed'))
|
||||
WHERE (COALESCE(j.order_qty,1) + COALESCE(j.pieces_per_plate,1) - 1)
|
||||
/ COALESCE(j.pieces_per_plate,1)
|
||||
> COALESCE((SELECT COUNT(*) FROM print_slots ps
|
||||
WHERE ps.job_id=j.id
|
||||
AND ps.status NOT IN ('cancelled','failed')), 0)
|
||||
ORDER BY j.created_at DESC LIMIT 20''').fetchall()
|
||||
blocks = conn.execute(
|
||||
"SELECT * FROM calendar_blocks"
|
||||
|
||||
Reference in New Issue
Block a user