Files
dtf-system/app/proof.py
Cauê Faleiros a9253d830a
All checks were successful
Build and deploy / Validate source (push) Successful in 1m6s
Build and deploy / Integration suite on a real stack (push) Successful in 4m5s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 2m6s
feat: Dropstar's answers of 23/10 that need nothing more from them
- JPG is refused in every product, at upload and by the server: it has no
  transparency, so the background prints and loose art packs as a box
- a PDF over 150 MB says before payment that the Site cannot check it, as a
  file opened by hand does
- every piece that is not square is tried both ways; the 1 cm rule left
  19,5 x 18,5 cm standing, 2 to a row instead of 3
- a mirrored order (UV only) is flagged on its card and panel, and its print
  file's footer ends in ESPELHADO, in bold
- print files are named DTF-23-item-1, and the order panel copies DTF-23-,
  so the code pasted into the folder's search finds them
- the proof: up to 30 cm, from the thinnest lines, a piece of each different
  artwork, at most three per order, free
- a file opened by hand costs R$ 2,00 more a metre by default, and the Site
  says so

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 09:33:22 -03:00

26 lines
1.1 KiB
Python

"""The print proof (Dropstar, 2026-10-21).
An order above 10 m prints a proof before the rest, checked by the print room
without stopping the order. Dropstar's rule (2026-10-23): up to 30 cm, from
the part with the thinnest lines, a piece of each different artwork, at most
three proofs per order, never billed. A customer may also ask for a proof at
checkout, for any length: that order waits for them, marked "Aguardando
contato", until they approve the photo sent by WhatsApp. Either way the room
marks "Prova OK" once the proof is checked, and without it the order does not
reach Finalizado.
"""
from decimal import Decimal
PROOF_ABOVE_METRES = Decimal('10')
CUSTOMER_NOTE = ('O cliente pediu uma prova antes de imprimir: mande a foto da prova pelo WhatsApp '
'e espere o aceite.')
def billed_metres(snapshot):
return sum((Decimal(str(item.get('billed_metres') or 0)) for item in snapshot.get('items') or []), Decimal(0))
def needs_proof(snapshot):
"""Whether the order prints a proof first: asked for, or above 10 m."""
return bool(snapshot.get('proof')) or billed_metres(snapshot) > PROOF_ABOVE_METRES