fix: Prova OK gives the parent its Prumo final and queues it (0.1)

The proof answer is the parent's check: every ready full print file Prumo
generated becomes an active final, and the parent enters Arte conferida.
Items that still need hand preparation stay in Arte recebida.
This commit is contained in:
Cauê Faleiros
2026-11-06 12:17:57 -03:00
parent c291f00e96
commit dc87d46801
2 changed files with 46 additions and 2 deletions

View File

@@ -275,6 +275,34 @@ def run():
assert mine['proof_ok_at'] and mine['proof_card']['proof_result'] == 'ok' and mine['state'] == 'tra', mine
print('PASS: an order with a proof waits for its proof card, which is answered OK or rejected in Revisão')
# Prova OK is the parent's check: the full print file Prumo already made
# becomes the parent final and the parent enters Arte conferida (0.1).
readable = upload_bytes(client, artwork(), name='LOCAL-PROOF-REAL.png')
long = loose_item(readable, copies=1)
parent = paid_order(client, long)
# A proof card for a small order, as the panel can open one; the parent
# file is only 10 cm tall, so this test does not draw a 10 m film.
with db.connect() as c:
c.execute("UPDATE dtf_local.orders SET snapshot=jsonb_set(snapshot,'{proof}','true') WHERE id=%s",
(parent['id'],))
client.call('/operator/orders/' + parent['id'] + '/proof-card', {}, operator=True)
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'])
wait_print(client, parent['id'], 'ready')
wait_print(client, card['id'], 'ready')
with db.connect() as c:
c.execute("UPDATE dtf_local.orders SET state='rev' WHERE id=%s", (card['id'],))
client.call('/operator/orders/' + card['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['state'] == 'tra' and mine['final_items'] == [0], mine
assert mine['proof_ok_at'] and mine['proof_card']['proof_result'] == 'ok', mine
with db.connect() as c:
final = c.execute('''SELECT note,created_by FROM dtf_local.order_files
WHERE order_id=%s AND kind='final' AND active''', (parent['id'],)).fetchone()
assert final['created_by'] == 'Prumo' and 'prova' in final['note'].lower(), final
print('PASS: Prova OK turns Prumo\'s full file into the parent final and queues it')
# A customer cannot see or reuse another order's generated file.
other = Client()
other.call('/session')