From 5dc41355623c363db45d0e73344f190e371b264c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Fri, 27 Nov 2026 09:26:48 -0300 Subject: [PATCH] fix: an HTML page from the proxy is a passing outage, a full machine and a proof card in Finalizado are said before the move (DTF-WEB-1Z, 20, 21) Co-Authored-By: Claude Opus 5.5 (1M context) --- web/kanban-board.js | 4 ++++ web/kanban-users.js | 7 +++++++ web/kanban.js | 4 +++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/web/kanban-board.js b/web/kanban-board.js index 1366ba2..6a4b46f 100644 --- a/web/kanban-board.js +++ b/web/kanban-board.js @@ -270,6 +270,10 @@ function renderBoard(){ // The card may have moved to another machine since the drag began (the // board reloaded in between, Sentry DTF-WEB-1P): said, not refused. if(!mayAct(order)){say('Pedido da '+(order.machine?.name||'outra máquina')+': só quem está nela move o card.');clearDrop();return;} + // A proof card ends with its answer, on the card (Sentry DTF-WEB-21). + if(state==='fin'&&order.proof_parent){ + say('A prova termina com Prova OK ou Prova reprovada, no card da prova.');openPanel(order.id);clearDrop();return; + } // Above 1 m Finalizado needs the review photo: the drop opens Revisão // instead of a refused move (Sentry DTF-WEB-B). if(state==='fin'&&order.state==='rev'&&needsReviewPhoto(order)){ diff --git a/web/kanban-users.js b/web/kanban-users.js index 7b87281..71c2ad5 100644 --- a/web/kanban-users.js +++ b/web/kanban-users.js @@ -692,6 +692,13 @@ async function pullTo(order, machineId){ if(machine&&!(machine.products||[]).includes(/^uv/.test(order.snapshot.items[0]?.mode||'')?'uv':'textil')){ say('A '+machine.name+' não imprime este produto.');return; } + // A machine with every place in Imprimindo taken (app/machines.py): said + // here, as its lane shows, and the card stays put (Sentry DTF-WEB-20). + if(machine){ + const cap=machine.places||board.printing_cap||3; + const busy=(board.orders||[]).filter(o=>o.state==='imp'&&!o.cancelled_at&&o.machine?.id===machine.id&&o.id!==order.id).length; + if(busy>=cap){say('A '+machine.name+' já tem '+busy+' em Imprimindo. Abre vaga quando um pedido sair de lá.');return;} + } const alert=(machine?.alerts||[]).find(row=>row.blocking); if(alert&&!await machineAlertDialog(order,target,alert))return; try{ diff --git a/web/kanban.js b/web/kanban.js index 275284e..5d89a3f 100644 --- a/web/kanban.js +++ b/web/kanban.js @@ -246,7 +246,9 @@ async function api(path,body,options={}){ catch(e){e.offline=true;throw e;} // The network can also drop while the answer arrives (Sentry DTF-WEB-1E). let d; - try{d=await r.json();}catch(e){if(e instanceof TypeError)e.offline=true;throw e;} + // An HTML page instead of the answer (the proxy while a container restarts, + // Sentry DTF-WEB-1Z) is as passing as no network: warned, reported if it lasts. + try{d=await r.json();}catch(e){if(e instanceof TypeError||e instanceof SyntaxError)e.offline=true;throw e;} if(!r.ok){ // A validation error is a list: name its first field and what was wrong // instead of the bare status (Sentry DTF-WEB-E).