All checks were successful
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m13s
Build and deploy / Validate source (push) Successful in 10s
Build and deploy / Integration suite on a real stack (push) Successful in 4m6s
The checkout's "Quero aprovar uma prova" box shows only when the cart is above 10 m, and the server keeps the request only then. Below 10 m there is no proof; above it the room's own proof stays automatic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
1.2 KiB
Python
27 lines
1.2 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. On an order above 10 m the customer
|
|
may also ask for a proof at checkout (below 10 m there is none, Dropstar
|
|
2026-10-28): 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
|