feat: a ready sheet's pieces under 5 mm show on the Kanban card (Marcus, 2026-11-26, #81)
All checks were successful
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Successful in 7m52s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m29s

The Site already counted them and warned the customer; the count now travels
with the item (close_pieces) to the card's flags, the order panel and the
quote review, so the room sees it before printing.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-26 14:43:25 -03:00
parent 3b9575b94b
commit 64a017e0a4
8 changed files with 27 additions and 1 deletions

View File

@@ -220,6 +220,10 @@ class Item(StrictModel):
# Residue dots under 2 mm the customer accepted printing on a ready sheet,
# rather than erasing them (Dropstar, 2026-10-29): 0 when none.
residue_accepted: int = Field(default=0, ge=0, le=1000000, strict=True)
# Pieces of a ready sheet under 5 mm from another, as the Site measured
# them: shown on the Kanban card so the room sees it before printing
# (Marcus, 2026-11-26, #81). 0 when none.
close_pieces: int = Field(default=0, ge=0, le=1000000, strict=True)
# The thinnest stroke the browser measured, in pixels at 300 DPI, and its
# contraction class (Dropstar, 2026-10-30): up to 4 C1, 5 to 19 C2, 20+ C3.
stroke_px: int | None = Field(default=None, ge=1, le=10000, strict=True)

View File

@@ -63,7 +63,7 @@ def approve(c, row, items, reviewer):
for item, original in zip(items, draft['items']):
if item.mode != original['mode'] or list(map(str, item.uploads)) != original['uploads']:
raise HTTPException(422, 'O produto e os arquivos não podem mudar na revisão.')
if item.production.model_dump(mode='json') != original['production'] or item.quality_status != original['quality_status'] or item.quality_acknowledged != original['quality_acknowledged'] or item.residue_accepted != original.get('residue_accepted', 0) or item.stroke_class != original.get('stroke_class') or item.stroke_px != original.get('stroke_px') or item.stroke_choice != original.get('stroke_choice') or (item.split and item.split.model_dump()) != original.get('split'):
if item.production.model_dump(mode='json') != original['production'] or item.quality_status != original['quality_status'] or item.quality_acknowledged != original['quality_acknowledged'] or item.residue_accepted != original.get('residue_accepted', 0) or item.close_pieces != original.get('close_pieces', 0) or item.stroke_class != original.get('stroke_class') or item.stroke_px != original.get('stroke_px') or item.stroke_choice != original.get('stroke_choice') or (item.split and item.split.model_dump()) != original.get('split'):
raise HTTPException(422, 'A montagem e a confirmação do cliente não podem mudar na revisão.')
for upload_id in item.uploads:
upload = upload_row(c, upload_id, row['owner'])
@@ -95,6 +95,7 @@ def approve(c, row, items, reviewer):
**({'proof_y_fraction': original['proof_y_fraction']}
if original.get('proof_y_fraction') is not None else {}),
**({'source_dpi': original['source_dpi']} if original.get('source_dpi') else {}),
**({'close_pieces': original['close_pieces']} if original.get('close_pieces') else {}),
**({'split': original['split']} if original.get('split') else {})})
items_total = cart['items_total']
coupon = cart['coupon']

View File

@@ -39,5 +39,17 @@ class SheetGapTests(unittest.TestCase):
self.assertEqual(str(caught.exception), SHEET_GAP_CHANGED)
class ClosePiecesTests(unittest.TestCase):
"""The Site's count of pieces under 5 mm travels with the item to the
Kanban card (Marcus, 2026-11-26, #81)."""
def test_the_count_is_kept_and_defaults_to_none(self):
item = sheet()
self.assertEqual(item.close_pieces, 0)
data = item.model_dump(mode='json')
self.assertEqual(Item.model_validate({**data, 'close_pieces': 14}).close_pieces, 14)
with self.assertRaises(ValueError):
Item.model_validate({**data, 'close_pieces': -1})
if __name__ == '__main__':
unittest.main()

View File

@@ -519,6 +519,7 @@
upload_id:uploads[index],...source}))},
quality_status:item.qualityStatus,quality_acknowledged:item.qualityAcknowledged,
residue_accepted:item.residueAccepted||0,
...(item.closePieces?{close_pieces:item.closePieces}:{}),
...(item.strokeClass?{stroke_px:item.strokePx,stroke_class:item.strokeClass}:{}),
...(item.strokeChoice?{stroke_choice:item.strokeChoice}:{}),
...(item.proofYFraction!=null?{proof_y_fraction:item.proofYFraction}:{}),

View File

@@ -52,6 +52,7 @@ const TREATED_NOTE='O arquivo final foi preparado pela equipe, não é a arte qu
const mirroredItem=item=>!!item.production?.sources?.some(source=>source.mirrored);
const MIRROR_NOTE='O cliente espelhou a arte: confira antes de imprimir';
// Residue dots under 2 mm the customer accepted printing (Dropstar, 2026-10-29).
const closeNote=n=>'A folha do cliente tem '+n+' peças a menos de 5 mm de outra: confira o recorte antes de imprimir';
const residueNote=item=>{const many=item.residue_accepted>1;
return item.residue_accepted+(many?' pontos menores':' ponto menor')+' que 2 mm, que '+(many?'podem':'pode')+' se perder no recorte';};
const residueBadge=item=>badge('! Resíduo aceito','warn','O cliente aceitou imprimir com '+residueNote(item));
@@ -421,6 +422,9 @@ function cardFlags(order){
if(live&&s.items.some(i=>i.quality_status==='warning'))out.push(['warn','Nota '+(lowestGrade(s.items)??'baixa'),'Nota da arte baixa: o cliente aceitou a ressalva de resolução']);
const dots=s.items.reduce((t,i)=>t+(i.residue_accepted||0),0);
if(live&&dots)out.push(['warn','Resíduo','O cliente aceitou imprimir com '+residueNote({residue_accepted:dots})]);
// A ready sheet with pieces closer than 5 mm (Marcus, 2026-11-26, #81).
const close=s.items.reduce((t,i)=>t+(i.close_pieces||0),0);
if(live&&close)out.push(['warn','Peças coladas',closeNote(close)]);
if(order.treated)out.push(['','Tratada',TREATED_NOTE+' Aprovado por '+order.treated.by+'.']);
if(live&&needsProof(order)&&order.proof_ok_at)out.push(['','Prova OK','Prova conferida por '+order.proof_ok_by+' em '+when(order.proof_ok_at)]);
if(isTest(order))out.push(['','Teste','Pedido de teste: sem pagamento, não vai ao Tiny']);

View File

@@ -1065,6 +1065,7 @@ function itemCard(order,item,index){
info.append(dl);
const notes=node('div',undefined,'inotes');
if(item.quality_status==='warning')notes.append(itemNote('O cliente aceitou a ressalva de resolução.','warn'));
if(item.close_pieces)notes.append(itemNote(closeNote(item.close_pieces)+'.','warn'));
if(item.residue_accepted)notes.append(itemNote('Resíduo: '+item.residue_accepted+' pontos, aceito pelo cliente'+
(item.residue_accepted_at?' às '+when(item.residue_accepted_at):'')+'.','warn'));
if(item.stroke_choice)notes.append(itemNote('Traços finos e áreas chapadas no mesmo arquivo: '+

View File

@@ -290,6 +290,7 @@ function quoteItem(item,fields,priced,index=0,count=1){
notes.append(item.quality_status==='ok'?itemNote('Qualidade conferida','ok'):item.quality_status==='warning'?
itemNote(item.quality_acknowledged?'Ressalva de resolução aceita pelo cliente':'Ressalva de resolução não aceita','warn'):itemNote('Qualidade não conferida'));
if(item.residue_accepted)notes.append(itemNote('Resíduo aceito pelo cliente: '+residueNote(item)+'.','warn'));
if(item.close_pieces)notes.append(itemNote(closeNote(item.close_pieces)+'.','warn'));
info.append(notes);
if(fields){
const grid=node('div',undefined,'inputs');

View File

@@ -345,6 +345,8 @@ function carrinho(){
qualityAcknowledged:false,
// The residue dots the customer accepted printing (Dropstar, 2026-10-29).
residueAccepted:residuosAceitos(),
// Peças a menos de 5 mm na folha pronta: a equipe vê no card (Marcus, 26/11/2026).
closePieces:ehFolha()?folhas.reduce((t,x)=>t+(x.an?.encostadas||0),0):0,
// The thinnest stroke and its contraction class (item 9), for the room.
...tracoDoItem(null,layout),
desc:(partes?partes.length+' folhas · ':'')+fmtM(cob)+' m · '+rs(unit)+'/m'};