feat: a ready sheet prints at its real size, centred on the film, with the customer's confirmation (Marcus, 2026-12-02)
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 7m55s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m43s

Replaces 7111995 (only 57,0 cm entered; a whole order of 56,5-56,9 cm
sheets was refused, DTF-WEB-2C). Marcus's rules, for Arquivo por metro,
Premium (57 cm) and UV (27 cm):
1. A known width up to the film (PNG recording 200 DPI or more, or a PDF
   page) enters at its real size, centred, billed by its real height.
2. Narrower: his warning before the cart, confirmation required
   (Imprimir no tamanho real / Enviar outro arquivo); recorded in the
   Prumo report ("cliente confirmou folha de 35,8 cm no tamanho real") and
   shown in the cart and payment summaries.
3. Wider than the film: refused with his message.
4. Unknown width: taken as the film's, DPI from the pixels; 200 or more
   with a confirmation, under 200 refused with the artes avulsas hint.
Within 0,1 cm of the film counts as the film. The server checks it all
again at checkout (sheet_width_issue, centred placement, size_confirmed).

Also ops.stretched_sheets: the ready-sheet orders since 16/10 laid out
wider than their real width (number, real width, factor), for Marcus.
Contract: output/revisao/contrato-folha-real.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-12-02 09:51:38 -03:00
parent 7af6c9797d
commit 41126a42fd
22 changed files with 634 additions and 153 deletions

View File

@@ -11,6 +11,17 @@ from psycopg.types.json import Jsonb
from app.core import db
from tests.print_file_test import artwork
def uv_sheet():
"""A UV ready sheet 27 x 13,5 cm at 300 DPI, inked inside a margin."""
import io
from PIL import Image, ImageDraw
image = Image.new('RGBA', (3189, 1595), (0, 0, 0, 0))
ImageDraw.Draw(image).rectangle([40, 40, 3149, 1555], fill=(220, 30, 60, 255))
out = io.BytesIO()
image.save(out, 'PNG', dpi=(300, 300))
return out.getvalue()
from tests.smoke_test import Client, item_spec, upload_bytes
@@ -36,9 +47,13 @@ def run():
early_id = None
order_id = None
upload_id = None
sheet_id = None
try:
upload_id = upload_bytes(client, artwork(), name=f'LOCAL-COUPON-{tag}.png')
sheet = {**item_spec('uvfile', '1', 0, upload_id, aspect=2),
# The UV ready sheet is its own 27 cm file at 300 DPI: the art above is
# 13,5 cm, and laid out at 27 cm it would be a stretched sheet.
sheet_id = upload_bytes(client, uv_sheet(), name=f'LOCAL-COUPON-SHEET-{tag}.png')
sheet = {**item_spec('uvfile', '1', 0, sheet_id, aspect=2),
'quality_status': 'warning', 'quality_acknowledged': True}
# The sheet is the customer's own file, not one someone opens by hand.
sheet['production']['sources'][0]['measurement'] = 'file'
@@ -155,8 +170,9 @@ def run():
c.execute('DELETE FROM dtf_local.quotes WHERE id=%s', (early_id,))
if coupon_id:
c.execute('DELETE FROM dtf_local.coupons WHERE id=%s', (coupon_id,))
if upload_id:
c.execute('DELETE FROM dtf_local.uploads WHERE id=%s', (upload_id,))
for uid in (upload_id, sheet_id):
if uid:
c.execute('DELETE FROM dtf_local.uploads WHERE id=%s', (uid,))
if __name__ == '__main__':