feat: the proof card, a child order the seller answers (Dropstar, 30/10 and 03/11)
Some checks failed
Build and deploy / Validate source (push) Successful in 1m8s
Build and deploy / Integration suite on a real stack (push) Failing after 3m14s
Build and deploy / Publish images (push) Has been skipped
Build and deploy / Secret scan and release gate (push) Successful in 9s
Some checks failed
Build and deploy / Validate source (push) Successful in 1m8s
Build and deploy / Integration suite on a real stack (push) Failing after 3m14s
Build and deploy / Publish images (push) Has been skipped
Build and deploy / Secret scan and release gate (push) Successful in 9s
An order with a proof (asked for at checkout, or above 10 m) gets a child
card "Prova": an order of its own (orders.parent_id), no sale, with the
film's first 30 cm as DTF-N-item-1-prova.png ("Prova do pedido DTF-N" in its
footer), which follows the flow up to Revisão like any card, hot folder
included. The order waits outside the queue, "Aguardando prova": it is not
pulled to Imprimindo, nor counted in the queue's places.
In Revisão the card is answered by the Vendedor, Gestão or the
Administrador (capability "proof"): Prova OK records who and when and puts
the order in Arte conferida when its finals are approved; Prova reprovada,
with its reason, sends the order back to Arte recebida, its final to be
approved again, and offers "Nova prova". Either way the card closes and
leaves the board. An order from before the cards keeps the old Prova OK.
The card is kept out of Tiny, e-mails, Números, the search, Finalizado and
the customer's account. Deleting an order takes its cards and their rows:
movements, order files and print files now cascade with their order.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ from uuid import uuid4
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from app.core import db
|
||||
from tests.payment_test import deliver
|
||||
from tests.smoke_test import Client, approved_quote as approval, upload_bytes
|
||||
|
||||
@@ -204,6 +205,56 @@ def run():
|
||||
assert red[3] == 255 and red[0] > 200 and red[1] < 60, red
|
||||
print('PASS: PDF artwork drawn into the PNG print file at 300 DPI')
|
||||
|
||||
# The proof card (Dropstar, 2026-10-30 and 2026-11-03): an order above
|
||||
# 10 m gets a child card "Prova"; the order waits outside the queue until
|
||||
# the card in Revisão gets its answer.
|
||||
# Artwork the generator refuses at once, so no 10 m file is drawn.
|
||||
unread = upload_bytes(client, b'LOCAL PRINT TEST - NOT AN IMAGE', name='LOCAL-PROOF-TEST.cdr')
|
||||
long = loose_item(unread, copies=1)
|
||||
long['metres'] = '10.5'
|
||||
long['production'] = {**long['production'], 'height_cm': 1050,
|
||||
'placements': [{**long['production']['placements'][0], 'y_cm': 1040}]}
|
||||
parent = paid_order(client, long)
|
||||
board = client.call('/operator/board', operator=True)['orders']
|
||||
mine = next(o for o in board if o['id'] == parent['id'])
|
||||
card = next(o for o in board if o['id'] == mine['proof_card']['id'])
|
||||
assert card['proof_parent']['number'] == parent['number'] and card['state'] == 'rec', card
|
||||
assert card['snapshot']['proof_of'] == parent['number'] and card['payment'] == {'provider': 'prova'}
|
||||
with db.connect() as c:
|
||||
assert not c.execute('SELECT 1 FROM dtf_local.outbox WHERE event_key LIKE %s', (card['id'] + '%',)).fetchone()
|
||||
c.execute("UPDATE dtf_local.orders SET state='rev' WHERE id=%s", (card['id'],))
|
||||
final = upload_bytes(client, b'LOCAL PROOF FINAL FIXTURE', order_id=parent['id'])
|
||||
version = client.call('/operator/orders/' + parent['id'] + '/final-files',
|
||||
{'version': parent['version'], 'files': [{'item_index': 0, 'upload_id': final}],
|
||||
'note': 'Local proof test final'}, operator=True)['version']
|
||||
version = client.call('/operator/orders/' + parent['id'] + '/move', {'state': 'tra', 'version': version},
|
||||
operator=True)['version']
|
||||
held = client.call('/operator/orders/' + parent['id'] + '/move', {'state': 'imp', 'version': version},
|
||||
operator=True, expected=409)
|
||||
assert 'Aguardando prova' in held['detail'], held
|
||||
client.call('/operator/orders/' + card['id'] + '/move', {'state': 'fin', 'version': card['version']},
|
||||
operator=True, expected=409)
|
||||
# Reprovada needs its reason; the order goes back to Arte recebida.
|
||||
client.call('/operator/orders/' + card['id'] + '/proof-answer', {'result': 'rejected', 'reason': 'x'},
|
||||
operator=True, expected=422)
|
||||
client.call('/operator/orders/' + card['id'] + '/proof-answer',
|
||||
{'result': 'rejected', 'reason': 'Cor do fundo errada'}, operator=True)
|
||||
client.call('/operator/orders/' + card['id'] + '/proof-answer', {'result': 'ok'}, operator=True, expected=409)
|
||||
board = client.call('/operator/board', operator=True)['orders']
|
||||
mine = next(o for o in board if o['id'] == parent['id'])
|
||||
assert mine['state'] == 'rec' and mine['proof_card']['proof_result'] == 'rejected', mine['proof_card']
|
||||
assert mine['proof_card']['proof_reason'] == 'Cor do fundo errada'
|
||||
assert not [o for o in board if o['id'] == card['id']], 'an answered proof card leaves the board'
|
||||
# A new card, and Prova OK lets the order into the queue.
|
||||
again = client.call('/operator/orders/' + parent['id'] + '/proof-card', {}, operator=True)
|
||||
client.call('/operator/orders/' + parent['id'] + '/proof-card', {}, operator=True, expected=409)
|
||||
with db.connect() as c:
|
||||
c.execute("UPDATE dtf_local.orders SET state='rev' WHERE id=%s", (again['id'],))
|
||||
client.call('/operator/orders/' + again['id'] + '/proof-answer', {'result': 'ok'}, operator=True)
|
||||
mine = next(o for o in client.call('/operator/board', operator=True)['orders'] if o['id'] == parent['id'])
|
||||
assert mine['proof_ok_at'] and mine['proof_card']['proof_result'] == 'ok', mine
|
||||
print('PASS: an order with a proof waits for its proof card, which is answered OK or rejected in Revisão')
|
||||
|
||||
# A customer cannot see or reuse another order's generated file.
|
||||
other = Client()
|
||||
other.call('/session')
|
||||
|
||||
Reference in New Issue
Block a user