feat: Dropstar's new flow: Arte conferida is the queue, Revisão and the Revisor
All checks were successful
Build and deploy / Validate source (push) Successful in 9s
Build and deploy / Integration suite on a real stack (push) Successful in 3m36s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m24s
All checks were successful
Build and deploy / Validate source (push) Successful in 9s
Build and deploy / Integration suite on a real stack (push) Successful in 3m36s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m24s
The board Dropstar drew on 2026-10-23: Arte recebida, Arte conferida, Imprimindo, Correção, Revisão, Finalizado. - Fila de impressão leaves the board: Arte conferida is the queue. It takes an order only with every item's final approved, keeps the finals as approved, orders its cards for printing and has the room's "Baixar" and the automatic folder. Orders that were in the queue move there once, with a line in their history - Revisão checks the printed sheet, and the new Revisor profile is the only one that sends an order to Finalizado (the superadmin too, for support) - who moves what, from the server (MOVES): the designer the artwork, asking for corrections and bringing the new art back; the operator Arte conferida to Imprimindo to Revisão; admin and gestão everything else, Correção included; a step back belongs to whoever makes the move it undoes - Tiny: Arte conferida is "Preparando envio" and Finalizado "Pronto para envio", for delivery orders too - Prova OK still comes before Finalizado; the customer's portal shows the new steps Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -204,13 +204,14 @@ try{
|
||||
await kanban.click('[data-tab="board"]');
|
||||
await kanban.click(`[data-card="${oid}"]`);
|
||||
await waitFor(()=>kanban.eval(`!!document.querySelector('[data-order="${oid}"] [data-move]')`),'order panel');
|
||||
for(const [title,state] of [['Arte conferida','tra'],['Fila de impressão','fil'],['Imprimindo','imp'],['Finalizado','fin']]){
|
||||
if(state==='fil'){
|
||||
// Dropstar's flow (2026-10-23): Arte conferida is the queue, Revisão before Finalizado.
|
||||
for(const [title,state] of [['Arte conferida','tra'],['Imprimindo','imp'],['Revisão','rev'],['Finalizado','fin']]){
|
||||
if(state==='tra'){
|
||||
// Without an approved final, the next step at the top is approving it,
|
||||
// not a move the server would refuse. The CDR has no ready file, so
|
||||
// the button opens the upload form there.
|
||||
await waitFor(()=>kanban.eval(`!!document.querySelector('[data-order="${oid}"] [data-approve]')`),'approve final button');
|
||||
assert.equal(await kanban.eval(`!!document.querySelector('[data-order="${oid}"] [data-move="fil"]')`),false);
|
||||
assert.equal(await kanban.eval(`!!document.querySelector('[data-order="${oid}"] [data-move="tra"]')`),false);
|
||||
await kanban.click(`[data-order="${oid}"] [data-approve]`);
|
||||
await waitFor(()=>kanban.eval(`(()=>{const input=document.querySelector('[data-order="${oid}"] [data-final-item]');return !!input&&!input.closest('form').hidden;})()`),'final upload controls');
|
||||
const doc=await kanban.call('DOM.getDocument');
|
||||
@@ -218,7 +219,7 @@ try{
|
||||
await kanban.call('DOM.setFileInputFiles',{nodeId:input.nodeId,files:[resolve('tests/fixtures/local-test.cdr')]});
|
||||
await kanban.fill(`[data-order="${oid}"] input[placeholder="Nota da revisão"]`,'Browser test final file');
|
||||
await kanban.eval(`(()=>{const check=document.querySelector('[data-order="${oid}"] [data-confirm]');check.click();check.closest('form').requestSubmit();})()`);
|
||||
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').version===2`),'final file approval');
|
||||
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').version===1`),'final file approval');
|
||||
// Approved before the queue: already on this computer, in Recebidos.
|
||||
const early='DTF-'+await kanban.eval(`board.orders.find(o=>o.id==='${oid}').number`)+'-item-1';
|
||||
await kanban.eval('syncFolder(true)');
|
||||
@@ -228,7 +229,7 @@ try{
|
||||
await waitFor(()=>kanban.eval(`!!document.querySelector('[data-order="${oid}"] [data-move="${state}"]')`),'move to '+title);
|
||||
await kanban.click(`[data-order="${oid}"] [data-move="${state}"]`);
|
||||
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').state==='${state}'`),'transition '+state);
|
||||
if(state==='fil'){
|
||||
if(state==='tra'){
|
||||
// Entering the queue saves its final file there, whole and named after the order.
|
||||
const prefix='DTF-'+await kanban.eval(`board.orders.find(o=>o.id==='${oid}').number`)+'-item-1';
|
||||
await waitFor(async()=>(await savedFiles()).some(n=>n.startsWith(prefix)&&!n.endsWith('.baixando')),'final file saved in the folder',45000);
|
||||
@@ -247,11 +248,11 @@ try{
|
||||
}
|
||||
}
|
||||
// Undo a mistaken move from the panel: one stage back with an internal reason.
|
||||
await waitFor(()=>kanban.eval(`!!document.querySelector('[data-order="${oid}"] [data-back="imp"]')`),'back button');
|
||||
await kanban.click(`[data-order="${oid}"] [data-back="imp"]`);
|
||||
await waitFor(()=>kanban.eval(`!!document.querySelector('[data-order="${oid}"] [data-back="rev"]')`),'back button');
|
||||
await kanban.click(`[data-order="${oid}"] [data-back="rev"]`);
|
||||
await kanban.fill(`[data-order="${oid}"] form.reason input`,'Movido por engano (teste)');
|
||||
await kanban.eval(`document.querySelector('[data-order="${oid}"] form.reason input').closest('form').requestSubmit()`);
|
||||
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').state==='imp'`),'undo to Imprimindo');
|
||||
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').state==='rev'`),'undo to Revisão');
|
||||
await waitFor(()=>kanban.eval(`!!document.querySelector('[data-order="${oid}"] [data-move="fin"]')`),'move to Finalizado again');
|
||||
await kanban.click(`[data-order="${oid}"] [data-move="fin"]`);
|
||||
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').state==='fin'`),'finished again');
|
||||
|
||||
@@ -138,7 +138,7 @@ def run():
|
||||
assert isinstance(after['machines'], list)
|
||||
# An order sent back counts once per stage; its passages are counted apart.
|
||||
with db.connect() as c:
|
||||
for step, (frm, to) in enumerate((('rec', 'tra'), ('tra', 'cor'), ('cor', 'tra'), ('tra', 'fil'))):
|
||||
for step, (frm, to) in enumerate((('rec', 'tra'), ('tra', 'cor'), ('cor', 'tra'), ('tra', 'imp'))):
|
||||
c.execute('''INSERT INTO dtf_local.movements(order_id,from_state,to_state,operator,reason,back,created_at)
|
||||
VALUES(%s,%s,%s,'kanban-test','',false,now()+%s*interval '1 second')''', (order_id, frm, to, step + 1))
|
||||
moved = client.call('/operator/stats?days=7', operator=True)
|
||||
@@ -151,7 +151,7 @@ def run():
|
||||
with db.connect() as c:
|
||||
c.execute('UPDATE dtf_local.orders SET created_at=%s::timestamptz WHERE id=%s', (f'{alone} 08:00-03', order_id))
|
||||
c.execute('DELETE FROM dtf_local.movements WHERE order_id=%s', (order_id,))
|
||||
for hour, (frm, to) in enumerate((('rec', 'tra'), ('tra', 'cor'), ('cor', 'tra'), ('tra', 'fil')), start=9):
|
||||
for hour, (frm, to) in enumerate((('rec', 'tra'), ('tra', 'cor'), ('cor', 'tra'), ('tra', 'imp')), start=9):
|
||||
c.execute('''INSERT INTO dtf_local.movements(order_id,from_state,to_state,operator,reason,back,created_at)
|
||||
VALUES(%s,%s,%s,'kanban-test','',false,%s::timestamptz)''', (order_id, frm, to, f'{alone} {hour}:00-03'))
|
||||
day = client.call(f'/operator/stats?start={alone}&end={alone}', operator=True)
|
||||
|
||||
@@ -152,6 +152,11 @@ def run():
|
||||
assert order['payment']['provider'] == 'teste' and order['state'] == 'rec', order
|
||||
assert tester.call('/operator/quotes/' + test_quote + '/test-order', {}, operator=True)['id'] == order['id']
|
||||
version = order['version']
|
||||
# Arte conferida, the print queue, takes the order once its final is approved.
|
||||
final = upload_bytes(tester, b'TEST ORDER FINAL', order_id=order['id'])
|
||||
version = tester.call('/operator/orders/' + order['id'] + '/final-files',
|
||||
{'version': version, 'files': [{'item_index': 0, 'upload_id': final}], 'note': 'Teste'},
|
||||
operator=True)['version']
|
||||
for state in ('tra',):
|
||||
moved = tester.call('/operator/orders/' + order['id'] + '/move', {'state': state, 'version': version}, operator=True)
|
||||
version = moved['version']
|
||||
|
||||
@@ -110,9 +110,9 @@ def run():
|
||||
{'version': order['version'], 'files': [{'item_index': 0, 'upload_id': str(row['upload_id'])}],
|
||||
'note': 'Generated print file checked'}, operator=True)
|
||||
version = result['version']
|
||||
for state in ('tra', 'fil'):
|
||||
client.call('/operator/orders/' + oid + '/move', {'state': state, 'version': version}, operator=True)
|
||||
version += 1
|
||||
# Arte conferida is the print queue (2026-10-23).
|
||||
client.call('/operator/orders/' + oid + '/move', {'state': 'tra', 'version': version}, operator=True)
|
||||
version += 1
|
||||
# Once queued for printing, the final set can no longer change.
|
||||
client.call('/operator/orders/' + oid + '/final-files',
|
||||
{'version': version, 'files': [{'item_index': 0, 'upload_id': str(row['upload_id'])}],
|
||||
|
||||
@@ -232,9 +232,11 @@ def run():
|
||||
client.call('/operator/orders/'+oid+'/move',{'state':'fin','version':0},operator=True,expected=409)
|
||||
client.call('/operator/orders/'+oid+'/move',{'state':'cor','version':0},operator=True,expected=422)
|
||||
version=0
|
||||
for state in ('cor','rec','tra','fil','imp','fin'):
|
||||
if state=='fil':
|
||||
client.call('/operator/orders/'+oid+'/move',{'state':'fil','version':version},operator=True,expected=409)
|
||||
# Dropstar's flow (2026-10-23): Arte conferida is the queue, Revisão comes before Finalizado.
|
||||
for state in ('cor','rec','tra','imp','rev','fin'):
|
||||
if state=='tra':
|
||||
# The queue takes approved final files only.
|
||||
client.call('/operator/orders/'+oid+'/move',{'state':'tra','version':version},operator=True,expected=409)
|
||||
files=[{'item_index':i,'upload_id':upload_bytes(client,b'LOCAL FINAL FIXTURE '+str(i).encode(),order_id=oid)} for i in range(4)]
|
||||
result=client.call('/operator/orders/'+oid+'/final-files',{'version':version,'files':files,'note':'Local test manual final-file approval'},operator=True)
|
||||
version=result['version']
|
||||
@@ -249,10 +251,10 @@ def run():
|
||||
# A mistaken move can be undone one stage at a time, with an internal
|
||||
# reason. The customer is not told again: going back and forward once more
|
||||
# adds no messages (the outbox count below stays 4).
|
||||
client.call('/operator/orders/'+oid+'/move',{'state':'imp','version':version},operator=True,expected=422)
|
||||
client.call('/operator/orders/'+oid+'/move',{'state':'tra','version':version},operator=True,expected=409)
|
||||
back=client.call('/operator/orders/'+oid+'/move',{'state':'imp','version':version,'reason':'Movido por engano'},operator=True)
|
||||
assert back['state']=='imp';version+=1
|
||||
client.call('/operator/orders/'+oid+'/move',{'state':'rev','version':version},operator=True,expected=422)
|
||||
client.call('/operator/orders/'+oid+'/move',{'state':'imp','version':version},operator=True,expected=409)
|
||||
back=client.call('/operator/orders/'+oid+'/move',{'state':'rev','version':version,'reason':'Movido por engano'},operator=True)
|
||||
assert back['state']=='rev';version+=1
|
||||
client.call('/operator/orders/'+oid+'/move',{'state':'fin','version':version},operator=True);version+=1
|
||||
history=client.call('/operator/orders/'+oid+'/history',operator=True)
|
||||
assert len(history)==8 and history[-2]['back'] and history[-2]['reason']=='Movido por engano' and not history[-1]['back']
|
||||
|
||||
50
tests/test_moves.py
Normal file
50
tests/test_moves.py
Normal file
@@ -0,0 +1,50 @@
|
||||
"""Who moves which card on the Kanban: Dropstar's flow of 2026-10-23."""
|
||||
import unittest
|
||||
|
||||
from app.core.auth import ROLES, may_move, may_reorder
|
||||
from app.runtime import BACK, STATES, TRANSITIONS
|
||||
|
||||
|
||||
def moves(role):
|
||||
return {(a, b) for a, nexts in TRANSITIONS.items() for b in nexts if may_move(role, a, b)}
|
||||
|
||||
|
||||
class MovesTest(unittest.TestCase):
|
||||
def test_the_board(self):
|
||||
# Fila de impressão left: Arte conferida is the queue; Revisão before Finalizado.
|
||||
self.assertEqual(list(STATES), ['rec', 'tra', 'imp', 'cor', 'rev', 'fin'])
|
||||
self.assertEqual(BACK, {'tra': 'rec', 'imp': 'tra', 'rev': 'imp', 'fin': 'rev'})
|
||||
self.assertIn('revisor', ROLES)
|
||||
|
||||
def test_each_profile_moves_its_part(self):
|
||||
self.assertEqual(moves('designer'), {('rec', 'tra'), ('rec', 'cor'), ('tra', 'cor'), ('cor', 'rec'), ('cor', 'tra')})
|
||||
self.assertEqual(moves('operador'), {('tra', 'imp'), ('imp', 'rev')})
|
||||
self.assertEqual(moves('revisor'), {('rev', 'fin')})
|
||||
self.assertEqual(moves('vendedor'), set())
|
||||
# Gestão sends to Correção and brings back, straight to Revisão too.
|
||||
for pair in (('imp', 'cor'), ('cor', 'rev'), ('rev', 'cor'), ('tra', 'imp'), ('rec', 'tra')):
|
||||
self.assertTrue(may_move('gestao', *pair), pair)
|
||||
|
||||
def test_only_the_revisor_releases_to_finalizado(self):
|
||||
for role in ROLES:
|
||||
self.assertEqual(may_move(role, 'rev', 'fin'), role in ('revisor', 'superadmin'), role)
|
||||
|
||||
def test_a_step_back_belongs_to_whoever_makes_the_move_it_undoes(self):
|
||||
self.assertTrue(may_move('operador', 'rev', 'imp', back=True))
|
||||
self.assertTrue(may_move('operador', 'imp', 'tra', back=True))
|
||||
self.assertFalse(may_move('operador', 'tra', 'rec', back=True))
|
||||
self.assertTrue(may_move('designer', 'tra', 'rec', back=True))
|
||||
self.assertTrue(may_move('revisor', 'fin', 'rev', back=True))
|
||||
self.assertTrue(may_move('gestao', 'fin', 'rev', back=True))
|
||||
self.assertFalse(may_move('vendedor', 'tra', 'rec', back=True))
|
||||
|
||||
def test_a_column_is_ordered_by_whoever_takes_its_cards_forward(self):
|
||||
self.assertEqual([s for s in STATES if may_reorder('operador', s)], ['tra', 'imp'])
|
||||
self.assertEqual([s for s in STATES if may_reorder('designer', s)], ['rec', 'cor'])
|
||||
self.assertEqual([s for s in STATES if may_reorder('revisor', s)], ['rev'])
|
||||
self.assertEqual([s for s in STATES if may_reorder('vendedor', s)], [])
|
||||
self.assertTrue(all(may_reorder('gestao', s) for s in STATES))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -302,15 +302,15 @@ class TinyStatusTests(FakeTinyCase):
|
||||
self.assertEqual(self.puts(), [])
|
||||
|
||||
@mock.patch.dict(os.environ, {'TINY_STATUS_UPDATES': 'true'})
|
||||
def test_ready_delivery_order_waits_for_freight(self):
|
||||
self.tiny.deliver('k1', PAID)
|
||||
self.calls.clear()
|
||||
ready = self.tiny.deliver('k2', {**READY, 'order': PAID['order']})
|
||||
self.assertEqual(ready['status'], 'not-applicable')
|
||||
self.assertEqual(self.calls, [])
|
||||
def test_a_finished_delivery_order_is_ready_too(self):
|
||||
# Dropstar's flow, 2026-10-23: Finalizado is "Pronto para envio" for every order.
|
||||
sale = self.tiny.deliver('k1', PAID)
|
||||
ready = self.tiny.deliver('k2', {**READY, 'order': PAID['order'], 'tiny_id': sale['tiny_id']})
|
||||
self.assertEqual((ready['status'], ready['situacao']), ('status-updated', 'Pronto para envio'))
|
||||
self.assertEqual(self.orders[0]['situacao'], 7)
|
||||
|
||||
@mock.patch.dict(os.environ, {'TINY_STATUS_UPDATES': 'true'})
|
||||
def test_printing_is_preparando_envio_but_never_moves_an_invoiced_order_back(self):
|
||||
def test_the_queue_is_preparando_envio_but_never_moves_an_invoiced_order_back(self):
|
||||
sale = self.tiny.deliver('k1', PAID)
|
||||
started = {**READY, 'event': 'production_started', 'order': PAID['order'], 'tiny_id': sale['tiny_id']}
|
||||
moved = self.tiny.deliver('k2', started)
|
||||
|
||||
@@ -71,7 +71,7 @@ def run():
|
||||
su = Client()
|
||||
su.call('/session')
|
||||
assert su.call('/operator/me', operator=True)['role'] == 'superadmin'
|
||||
emails = {r: f'{r}-{tag}@example.test' for r in ('admin', 'operador', 'vendedor', 'designer')}
|
||||
emails = {r: f'{r}-{tag}@example.test' for r in ('admin', 'operador', 'vendedor', 'designer', 'revisor')}
|
||||
owner = uuid4()
|
||||
machines, made = [], []
|
||||
try:
|
||||
@@ -123,11 +123,20 @@ def run():
|
||||
# On the UV machine of this test, whatever the others carry.
|
||||
su.call(f'/operator/orders/{uv_o}/machine', {'machine_id': uv}, operator=True)
|
||||
|
||||
# The operator of the UV machine sees only its orders, moves them, and nothing more.
|
||||
# The operator of the UV machine sees only its orders and prints them:
|
||||
# Arte conferida to Imprimindo to Revisão, nothing else (Dropstar, 2026-10-23).
|
||||
op = signed_in(emails['operador'])
|
||||
seen = {o['id'] for o in op.call('/operator/board')['orders']}
|
||||
assert str(uv_o) in seen and str(textil_o) not in seen, seen
|
||||
op.call(f'/operator/orders/{uv_o}/move', {'state': 'tra', 'version': 0, 'reason': ''})
|
||||
assert sorted(op.call('/operator/me')['moves']) == [['imp', 'rev'], ['imp', 'tra'], ['rev', 'imp'], ['tra', 'imp']]
|
||||
op.call(f'/operator/orders/{uv_o}/move', {'state': 'tra', 'version': 0, 'reason': ''}, expected=403)
|
||||
with db.connect() as c:
|
||||
c.execute("UPDATE dtf_local.orders SET state='imp' WHERE id=%s", (uv_o,))
|
||||
op.call(f'/operator/orders/{uv_o}/move', {'state': 'cor', 'version': 0, 'reason': 'borrou'}, expected=403)
|
||||
printed = op.call(f'/operator/orders/{uv_o}/move', {'state': 'rev', 'version': 0, 'reason': ''})
|
||||
refused = op.call(f'/operator/orders/{uv_o}/move', {'state': 'fin', 'version': printed['version'], 'reason': ''},
|
||||
expected=403)
|
||||
assert refused['detail'] == 'Só o Revisor manda o pedido para Finalizado.', refused
|
||||
op.call(f'/operator/orders/{uv_o}/cancel', {'note': 'não pode'}, expected=403)
|
||||
op.call('/operator/users', expected=403)
|
||||
op.call('/operator/payment-events', expected=403)
|
||||
@@ -144,6 +153,18 @@ def run():
|
||||
seller.call(f'/operator/orders/{textil_o}/machine', {'machine_id': None}, expected=403)
|
||||
seller.call(f'/operator/orders/{textil_o}/contact', {'waiting': True, 'note': 'Ligar'}, expected=403)
|
||||
assert seller.call('/operator/me')['can'] == ['view']
|
||||
# Only the Revisor releases to Finalizado: not even the administrator.
|
||||
admin.call(f'/operator/orders/{uv_o}/move', {'state': 'fin', 'version': printed['version'], 'reason': ''},
|
||||
expected=403)
|
||||
admin.call('/operator/users', {'name': 'Confere', 'email': emails['revisor'], 'role': 'revisor',
|
||||
'password': PASSWORD})
|
||||
reviewer = signed_in(emails['revisor'])
|
||||
me = reviewer.call('/operator/me')
|
||||
assert me['can'] == ['view'] and sorted(me['moves']) == [['fin', 'rev'], ['rev', 'fin']] and me['reorder'] == ['rev'], me
|
||||
reviewer.call(f'/operator/orders/{textil_o}/move', {'state': 'tra', 'version': 0, 'reason': ''}, expected=403)
|
||||
assert reviewer.call(f'/operator/orders/{uv_o}/move', {'state': 'fin', 'version': printed['version'],
|
||||
'reason': ''})['state'] == 'fin'
|
||||
|
||||
# The designer: every order, whatever its machine; the artwork stages only.
|
||||
admin.call('/operator/users', {'name': 'Arte', 'email': emails['designer'], 'role': 'designer',
|
||||
'password': PASSWORD, 'machines': [uv]})
|
||||
@@ -152,8 +173,17 @@ def run():
|
||||
assert set(designer.call('/operator/me')['can']) == {'view', 'produce'}
|
||||
assert {str(uv_o), str(textil_o)} <= {o['id'] for o in designer.call('/operator/board')['orders']}
|
||||
version = next(o for o in designer.call('/operator/board')['orders'] if o['id'] == str(textil_o))['version']
|
||||
moved = designer.call(f'/operator/orders/{textil_o}/move', {'state': 'tra', 'version': version, 'reason': ''})
|
||||
designer.call(f'/operator/orders/{textil_o}/move', {'state': 'fil', 'version': moved['version'], 'reason': ''},
|
||||
# A correction and back; Arte conferida only with the final approved.
|
||||
moved = designer.call(f'/operator/orders/{textil_o}/move', {'state': 'cor', 'version': version,
|
||||
'reason': 'fundo branco'})
|
||||
moved = designer.call(f'/operator/orders/{textil_o}/move', {'state': 'rec', 'version': moved['version'],
|
||||
'reason': ''})
|
||||
designer.call(f'/operator/orders/{textil_o}/move', {'state': 'tra', 'version': moved['version'], 'reason': ''},
|
||||
expected=409)
|
||||
# In the queue the card is the print room's; the designer only takes it back.
|
||||
with db.connect() as c:
|
||||
c.execute("UPDATE dtf_local.orders SET state='tra' WHERE id=%s", (textil_o,))
|
||||
designer.call(f'/operator/orders/{textil_o}/move', {'state': 'imp', 'version': moved['version'], 'reason': ''},
|
||||
expected=403)
|
||||
designer.call(f'/operator/orders/{textil_o}/move', {'state': 'rec', 'version': moved['version'],
|
||||
'reason': 'arte trocada'})
|
||||
@@ -167,7 +197,7 @@ def run():
|
||||
with db.connect() as c:
|
||||
long_q, long_o = order_fixture(c, owner, 'file', metres='12')
|
||||
made.append((long_q, long_o))
|
||||
c.execute("UPDATE dtf_local.orders SET state='imp' WHERE id=%s", (long_o,))
|
||||
c.execute("UPDATE dtf_local.orders SET state='rev' WHERE id=%s", (long_o,))
|
||||
version = next(o for o in su.call('/operator/board', operator=True)['orders'] if o['id'] == str(long_o))['version']
|
||||
su.call(f'/operator/orders/{long_o}/move', {'state': 'fin', 'version': version, 'reason': ''},
|
||||
operator=True, expected=409)
|
||||
@@ -181,7 +211,7 @@ def run():
|
||||
with db.connect() as c:
|
||||
short_q, short_o = order_fixture(c, owner, 'file', metres='10')
|
||||
made.append((short_q, short_o))
|
||||
c.execute("UPDATE dtf_local.orders SET state='imp' WHERE id=%s", (short_o,))
|
||||
c.execute("UPDATE dtf_local.orders SET state='rev' WHERE id=%s", (short_o,))
|
||||
version = next(o for o in su.call('/operator/board', operator=True)['orders'] if o['id'] == str(short_o))['version']
|
||||
su.call(f'/operator/orders/{short_o}/move', {'state': 'fin', 'version': version, 'reason': ''}, operator=True)
|
||||
# Asked for at checkout: the paid order arrives waiting for the customer's word.
|
||||
|
||||
@@ -49,8 +49,9 @@ def run():
|
||||
|
||||
def move(state,version):
|
||||
return customer.call('/operator/orders/'+oid+'/move',{'state':state,'version':version,'reason':'Please replace the artwork' if state=='cor' else ''},operator=True)['version']
|
||||
version=move('tra',0)
|
||||
customer.call('/operator/orders/'+oid+'/move',{'state':'fil','version':version},operator=True,expected=409)
|
||||
# Arte conferida is the print queue (2026-10-23): it takes approved finals only.
|
||||
version=0
|
||||
customer.call('/operator/orders/'+oid+'/move',{'state':'tra','version':version},operator=True,expected=409)
|
||||
final_id=upload_bytes(customer,b'LOCAL FINAL VERSION ONE',order_id=oid)
|
||||
customer.call('/uploads/'+final_id,expected=404)
|
||||
body={'version':version,'files':[{'item_index':0,'upload_id':final_id}],'note':'Manually checked final'}
|
||||
@@ -61,7 +62,7 @@ def run():
|
||||
link=customer.call('/customer/orders/'+oid+'/files/'+final['id']+'/download')
|
||||
assert urlopen(link['url']).read()==b'LOCAL FINAL VERSION ONE'
|
||||
guest=Client();guest.call('/session');guest.call('/customer/orders/'+oid+'/files/'+final['id']+'/download',expected=404)
|
||||
version=move('fil',version)
|
||||
version=move('tra',version)
|
||||
# The print queue's files come named after their order, straight from storage.
|
||||
queued=customer.call('/operator/queue/finals',operator=True)['files']
|
||||
mine=[f for f in queued if urlopen(f['url']).read()==b'LOCAL FINAL VERSION ONE']
|
||||
@@ -81,8 +82,7 @@ def run():
|
||||
files=customer.call('/operator/orders/'+oid+'/files',operator=True)
|
||||
assert any(f['kind']=='correction' and f['active'] and f['upload_id']==correction_id for f in files)
|
||||
assert not any(f['kind']=='final' and f['active'] for f in files), 'new correction kept a stale final active'
|
||||
version=move('tra',version)
|
||||
customer.call('/operator/orders/'+oid+'/move',{'state':'fil','version':version},operator=True,expected=409)
|
||||
customer.call('/operator/orders/'+oid+'/move',{'state':'tra','version':version},operator=True,expected=409)
|
||||
# The correction itself can be approved as the final of the item it corrects.
|
||||
version=customer.call('/operator/orders/'+oid+'/final-files',{'version':version,'files':[{'item_index':0,'upload_id':correction_id}],'note':'Correction is print-ready'},operator=True)['version']
|
||||
files=customer.call('/operator/orders/'+oid+'/files',operator=True)
|
||||
@@ -90,7 +90,9 @@ def run():
|
||||
customer.call('/operator/orders/'+oid+'/final-files',{'version':version,'files':[{'item_index':0,'upload_id':correction_id}],'note':'Twice'},operator=True,expected=409)
|
||||
new_final=upload_bytes(customer,b'LOCAL FINAL VERSION TWO',order_id=oid)
|
||||
version=customer.call('/operator/orders/'+oid+'/final-files',{'version':version,'files':[{'item_index':0,'upload_id':new_final}],'note':'Checked corrected final'},operator=True)['version']
|
||||
for state in ('fil','imp','fin'):version=move(state,version)
|
||||
for state in ('tra','imp','rev','fin'):version=move(state,version)
|
||||
# In the queue the finals stay as approved.
|
||||
customer.call('/operator/orders/'+oid+'/final-files',{'version':version,'files':[{'item_index':0,'upload_id':new_final}],'note':'Too late'},operator=True,expected=409)
|
||||
detail=other.call('/customer/orders/'+oid)
|
||||
assert detail['state']=='fin'
|
||||
assert sum(f['active'] and f['kind']=='final' for f in detail['files'])==1
|
||||
|
||||
Reference in New Issue
Block a user