fix: a handled "O pedido mudou" no longer reaches Sentry (DTF-WEB-7, DTF-WEB-K), and the 90-day chart is readable on a phone
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 7m35s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 59s

saveFinalFiles and pullMove answer a stale-version 409 by reloading and
trying once more, but api() had already reported it. The first call now
expects the 409; one they cannot answer is still reported (reportRefusal),
and any other status is reported by api() as before, once.

Past a month the chart's gap is 1 px (90 bars were under 1 px each on a
375 px phone), and the last date ends at the chart's edge instead of being cut.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-12-01 12:46:44 -03:00
parent c2ffe08db5
commit 741db76fa9
6 changed files with 31 additions and 10 deletions

View File

@@ -588,11 +588,14 @@ function readyFinals(order){
// form dialog then closes itself. Anything else is still an error, and the
// version is never resent blindly.
async function saveFinalFiles(order, files, note){
const path='/orders/'+order.id+'/final-files';
try{
await api('/orders/'+order.id+'/final-files',{version:order.version,files,note});
// The first 409 is expected: it is answered below, so it is not reported;
// one this function does not answer is (reportRefusal).
await api(path,{version:order.version,files,note},{expected:[409]});
return false;
}catch(error){
if(error.status!==409||!String(error.message).startsWith('O pedido mudou'))throw error;
if(error.status!==409||!String(error.message).startsWith('O pedido mudou'))throw reportRefusal(path,error);
await load();
const fresh=(board.orders||[]).find(row=>row.id===order.id);
if(fresh&&(finalDone(fresh)||!['rec','cor'].includes(fresh.state))){
@@ -603,10 +606,10 @@ async function saveFinalFiles(order, files, note){
// these finals: the person already confirmed them, so try once more with
// the fresh version; the server checks everything again (Sentry DTF-WEB-7).
if(fresh&&!fresh.cancelled_at){
await api('/orders/'+order.id+'/final-files',{version:fresh.version,files,note});
await api(path,{version:fresh.version,files,note});
return false;
}
throw error;
throw reportRefusal(path,error);
}
}
// A customer's correction or an original may not be the transparent 300 DPI