feat: residue and a solid background stop a ready sheet before payment
Some checks failed
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Failing after 4m10s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Has been skipped

Dropstar's items 2 and 3 (2026-10-21): both were warnings the customer
could pay past; now one dot is enough to stop the order.

- every pixel is read (images in strips at 1:1, large PNGs while they
  stream, PDFs rendered in strips at about 0,2 mm): the old check shrank
  the image first and could miss a small dot, or sampled every n-th pixel
- a residue is ink under 2 mm on both sides, measured from where the ink
  starts and ends in each cell: the same dot gets the same verdict wherever
  it falls on the grid, from 0,5 to 4 mm (his acceptance test)
- a solid background is under 1,5 % of transparent pixels; a JPG sheet
  always has one
- the sheet says how many dots there are, circles them on the preview, and
  asks to erase them and send again; the order waits for the check to end
- the page no longer offers JPG for a ready sheet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-22 16:37:46 -03:00
parent fe7bf4ef07
commit e3c31e43e5
8 changed files with 258 additions and 71 deletions

View File

@@ -3,6 +3,9 @@
Loaded as classic scripts in the order listed there: they share one global
scope and run top to bottom, exactly as the original did. */
// ── enviar
// Folha que a impressora estragaria: com resíduo de recorte ou sem fundo
// transparente. Só vale para o que o navegador conferiu.
const folhaBarrada=x=>!!(x.an && !x.an.grande && (x.an.fundoChapado || x.an.residuos));
// Avalia sozinho conforme o cliente sobe e preenche. Devolve o que ainda falta,
// para a fila dizer em texto em vez de travar num botão.
function avaliar(){
@@ -16,6 +19,15 @@ function avaliar(){
const semMedida=folhas.filter(x=>!(x.m>0)).length;
if(semMedida) return {pronto:false, falta:'Informe o comprimento de '+semMedida+
' folha'+(semMedida>1?'s':'')+'.'};
// Resíduo e fundo chapado barram antes do pagamento, com um ponto só
// (Dropstar, 21/10/2026): então o pedido espera a conferência terminar.
const lendo=folhas.find(x=>x.pct!=null);
if(lendo) return {pronto:false, falta:'Conferindo '+lendo.f.name+'…'};
const barrada=folhas.find(folhaBarrada);
if(barrada) return {pronto:false, falta:barrada.an.fundoChapado
? barrada.f.name+' está sem fundo transparente. Exporte a folha com fundo transparente, em PNG ou PDF, e envie de novo.'
: barrada.f.name+' tem '+barrada.an.residuos+' ponto'+(barrada.an.residuos>1?'s':'')+
' de recorte. Apague e envie de novo.'};
metros=folhaTotalM();
reencaixado=false;
const ans=folhas.map(x=>x.an).filter(Boolean);