feat: 8 mm of clear film between the copies and sheets of a ready sheet, billed (Marcus, 2026-11-26)
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 7m43s
Build and deploy / Secret scan and release gate (push) Successful in 8s
Build and deploy / Publish images (push) Successful in 1m23s
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 7m43s
Build and deploy / Secret scan and release gate (push) Successful in 8s
Build and deploy / Publish images (push) Successful in 1m23s
The Site stacked a ready sheet's copies with nothing between them (#81's were 0,3 mm apart). Now 8 mm separates each copy and each sheet from the next, and the metres include it, as Marcus confirmed. A new cart without the gap is refused with the reason; a quote made before is still reviewed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -101,7 +101,7 @@ jobs:
|
||||
# the generator's geometry. The provider suites use a fake transport: they
|
||||
# prove the documented contract, not the integration.
|
||||
- name: Print-file geometry and provider adapters
|
||||
run: $COMPOSE exec -T api python -m unittest tests.test_printfile tests.test_printpng tests.test_mercadopago tests.test_tiny tests.test_cnpj tests.test_payment_messages tests.test_jadlog tests.test_correios tests.test_quote_review tests.test_moves tests.test_large_files tests.test_grade_check tests.test_schema tests.test_customer_document tests.test_mail_html tests.test_layout_rules tests.test_proof_cut tests.test_proof_render tests.test_sheet_trim tests.test_one_machine tests.test_profiles tests.test_prumo tests.test_speed tests.test_printpng_validate tests.test_machine_log tests.test_machine_stats tests.test_label tests.test_observability tests.test_worker_drain tests.test_db_outage tests.test_health -v
|
||||
run: $COMPOSE exec -T api python -m unittest tests.test_printfile tests.test_printpng tests.test_mercadopago tests.test_tiny tests.test_cnpj tests.test_payment_messages tests.test_jadlog tests.test_correios tests.test_quote_review tests.test_moves tests.test_large_files tests.test_grade_check tests.test_schema tests.test_customer_document tests.test_mail_html tests.test_layout_rules tests.test_proof_cut tests.test_proof_render tests.test_sheet_trim tests.test_one_machine tests.test_profiles tests.test_sheet_gap tests.test_prumo tests.test_speed tests.test_printpng_validate tests.test_machine_log tests.test_machine_stats tests.test_label tests.test_observability tests.test_worker_drain tests.test_db_outage tests.test_health -v
|
||||
|
||||
- name: Runtime and retention regressions
|
||||
run: |
|
||||
|
||||
@@ -166,6 +166,24 @@ class Split(StrictModel):
|
||||
|
||||
|
||||
UV_MODES = ('uvfile', 'uv')
|
||||
SHEET_MODES = ('file', 'uvfile', 'premium')
|
||||
# Clear film between the copies of a ready sheet, and between its sheets, for
|
||||
# cutting; billed like the rest (Marcus, 2026-11-26).
|
||||
SHEET_GAP_CM = Decimal('0.8')
|
||||
SHEET_GAP_CHANGED = ('O espaço entre as cópias da folha pronta passou a ser de 8 mm. '
|
||||
'Remova este item do carrinho e adicione de novo.')
|
||||
|
||||
|
||||
def check_sheet_gaps(items):
|
||||
"""A ready sheet's copies and sheets are SHEET_GAP_CM apart. Only a new
|
||||
cart is held to it: a quote made before still goes through review."""
|
||||
for item in items:
|
||||
if item.mode not in SHEET_MODES:
|
||||
continue
|
||||
placements = sorted(item.production.placements, key=lambda p: p.y_cm)
|
||||
for above, below in zip(placements, placements[1:]):
|
||||
if below.y_cm < above.y_cm + above.length_cm + SHEET_GAP_CM - Decimal('0.02'):
|
||||
raise ValueError(SHEET_GAP_CHANGED)
|
||||
ONE_MACHINE = ('Esse produto é impresso em outra máquina e precisa de um pedido separado. '
|
||||
'Finalize este pedido e faça um novo com ele.')
|
||||
|
||||
@@ -323,6 +341,7 @@ class QuoteRequest(StrictModel):
|
||||
def splits_complete(self):
|
||||
check_splits(self.items)
|
||||
check_one_machine(self.items)
|
||||
check_sheet_gaps(self.items)
|
||||
return self
|
||||
|
||||
@model_validator(mode='after')
|
||||
|
||||
@@ -347,7 +347,8 @@ try{
|
||||
// With a sheet loaded the declaration is locked; it cannot flip under the customer.
|
||||
assert.equal(await evaluate(`document.querySelector('#tipoEnvio .cam[data-tipo="avulsa"]').disabled`),true);
|
||||
await evaluate(`(()=>{const el=$('lista').querySelector('[data-repf]');el.value=2;el.dispatchEvent(new Event('change',{bubbles:true}));})()`);
|
||||
await waitFor(()=>evaluate('Math.abs(metros-2*folhas[0].m)<0.0001 && folhas[0].m<0.2'),'ready-sheet repetitions');
|
||||
// Two copies and the 8 mm between them (Marcus, 2026-11-26).
|
||||
await waitFor(()=>evaluate('Math.abs(metros-(2*folhas[0].m+0.008))<0.0001 && folhas[0].m<0.2'),'ready-sheet repetitions');
|
||||
assert.equal(await evaluate(`document.querySelectorAll('.folhaPrevia').length`),1);
|
||||
await evaluate(`(()=>{folhas.push({f:new File(['manual'],'manual.cdr'),med:null,rep:1,m:1,an:null});pintaFolha();})()`);
|
||||
await waitFor(()=>evaluate(`itemAtual?.nota===0 && itemAtual?.unit===PRECO[modo]+TAXA_MANUAL`),'mixed analyzed and manual sheets: the price plus the manual charge');
|
||||
|
||||
43
tests/test_sheet_gap.py
Normal file
43
tests/test_sheet_gap.py
Normal file
@@ -0,0 +1,43 @@
|
||||
"""8 mm of clear film between the copies of a ready sheet (Marcus, 2026-11-26):
|
||||
a new cart must carry it; a quote made before is still reviewed.
|
||||
|
||||
Run from the repository root: python3 -m unittest tests.test_sheet_gap -v.
|
||||
"""
|
||||
import unittest
|
||||
from uuid import uuid4
|
||||
|
||||
from app.core.models import SHEET_GAP_CHANGED, Item, check_sheet_gaps
|
||||
|
||||
|
||||
def sheet(copies=3, gap=0.8, mode='file'):
|
||||
upload = str(uuid4())
|
||||
width = 27 if mode == 'uvfile' else 57
|
||||
length = 20
|
||||
placements = [{'source_index': 0, 'copy_index': i, 'x_cm': 0, 'y_cm': round(i * (length + gap), 4),
|
||||
'width_cm': width, 'length_cm': length, 'rotation_degrees': 0, 'mirrored': False}
|
||||
for i in range(copies)]
|
||||
height = round(copies * length + (copies - 1) * gap, 4)
|
||||
return Item.model_validate({
|
||||
'mode': mode, 'metres': str(height / 100), 'grade': 100, 'uploads': [upload],
|
||||
'quality_status': 'ok', 'quality_acknowledged': False,
|
||||
'production': {'version': 3, 'film_width_cm': width, 'height_cm': height,
|
||||
'sources': [{'upload_id': upload, 'kind': 'sheet', 'width_cm': width,
|
||||
'length_cm': length, 'copies': copies, 'measurement': 'file'}],
|
||||
'placements': placements}})
|
||||
|
||||
|
||||
class SheetGapTests(unittest.TestCase):
|
||||
def test_copies_8_mm_apart_pass(self):
|
||||
check_sheet_gaps([sheet()])
|
||||
check_sheet_gaps([sheet(copies=1, gap=0)])
|
||||
check_sheet_gaps([sheet(mode='uvfile')])
|
||||
|
||||
def test_copies_without_the_gap_are_refused_with_the_reason(self):
|
||||
for gap in (0, 0.03, 0.5):
|
||||
with self.assertRaises(ValueError) as caught:
|
||||
check_sheet_gaps([sheet(gap=gap)])
|
||||
self.assertEqual(str(caught.exception), SHEET_GAP_CHANGED)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -24,9 +24,11 @@ TOO_MANY = 'Este item tem mais de 200 arquivos. Divida em dois itens.'
|
||||
|
||||
|
||||
def item_with(uploads):
|
||||
"""One ready-sheet item: one source per upload, stacked in a row."""
|
||||
"""One ready-sheet item: one source per upload, stacked in a row, 8 mm
|
||||
apart (models.SHEET_GAP_CM)."""
|
||||
count = len(uploads)
|
||||
height = count * 0.3
|
||||
step = 0.25 + 0.8
|
||||
height = round(count * step - 0.8, 4)
|
||||
return {
|
||||
'mode': 'file', 'metres': round(height / 100, 4), 'grade': 100, 'uploads': uploads,
|
||||
'production': {
|
||||
@@ -35,7 +37,7 @@ def item_with(uploads):
|
||||
'copies': 1, 'rotation_degrees': 0, 'mirrored': False,
|
||||
'measurement': 'file'} for uid in uploads],
|
||||
'placements': [{'source_index': index, 'copy_index': 0, 'x_cm': 0,
|
||||
'y_cm': round(index * 0.3, 4), 'width_cm': 0.5, 'length_cm': 0.25,
|
||||
'y_cm': round(index * step, 4), 'width_cm': 0.5, 'length_cm': 0.25,
|
||||
'rotation_degrees': 0, 'mirrored': False} for index in range(count)]},
|
||||
'quality_status': 'ok', 'quality_acknowledged': False, 'residue_accepted': 0}
|
||||
|
||||
|
||||
@@ -307,6 +307,8 @@ function carrinho(){
|
||||
const placements=[];
|
||||
sources.forEach((source,source_index)=>{
|
||||
for(let copy_index=0;copy_index<source.copies;copy_index++){
|
||||
// MARGEM_FOLHA_CM entre uma cópia e a próxima, nunca depois da última.
|
||||
if(placements.length)y+=MARGEM_FOLHA_CM;
|
||||
placements.push({source_index,copy_index,x_cm:0,y_cm:+y.toFixed(4),
|
||||
width_cm:source.width_cm,length_cm:source.length_cm,
|
||||
rotation_degrees:0,mirrored:false});
|
||||
|
||||
@@ -123,7 +123,13 @@ let CLIENTE='SEU NOME AQUI', PEDIDO='000000';
|
||||
|
||||
let modo=null, artes=[], recemChegada=null, metros=0, nota=0, reencaixado=false;
|
||||
let folhas=[]; // [{f, med, rep, m}] · o cliente pode subir várias
|
||||
const folhaTotalM=()=>folhas.reduce((t,x)=>t+(x.m||0)*(x.rep||1),0);
|
||||
// Entre uma cópia e outra da folha pronta, e entre uma folha e outra, 8 mm de
|
||||
// filme limpo para o recorte; entram na metragem cobrada (Marcus, 26/11/2026).
|
||||
const MARGEM_FOLHA_CM=0.8;
|
||||
const folhaTotalM=()=>{
|
||||
const copias=folhas.reduce((t,x)=>t+(x.m>0?(x.rep||1):0),0);
|
||||
return folhas.reduce((t,x)=>t+(x.m||0)*(x.rep||1),0)+Math.max(0,copias-1)*MARGEM_FOLHA_CM/100;
|
||||
};
|
||||
// O cliente declara o que está mandando escolhendo o produto, em vez de o site
|
||||
// adivinhar pelo formato do arquivo. A declaração de folha montada é conferida na
|
||||
// medição: uma imagem sem pixel para ocupar a largura do filme não é uma folha.
|
||||
|
||||
Reference in New Issue
Block a user