feat: Dropstar's corrections of 21/10 that need no answer from them
All checks were successful
Build and deploy / Validate source (push) Successful in 1m30s
Build and deploy / Integration suite on a real stack (push) Successful in 4m2s
Build and deploy / Secret scan and release gate (push) Successful in 14s
Build and deploy / Publish images (push) Successful in 1m48s

- the home example priced as the ready sheet it shows (nota 92, R$ 14,90)
- opening hours 7h to 18h, and art sent at any time
- uploads up to 1 GB, every file scanned
- a Designer profile: artwork and corrections on every order, moving only
  among Arte recebida, Arte conferida and Correção
- Números by date range, per machine, and orders apart from passages

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-22 10:09:15 -03:00
parent a2382f4834
commit d4494a0654
21 changed files with 279 additions and 89 deletions

View File

@@ -67,7 +67,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')}
emails = {r: f'{r}-{tag}@example.test' for r in ('admin', 'operador', 'vendedor', 'designer')}
owner = uuid4()
machines, made = [], []
try:
@@ -140,6 +140,24 @@ 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']
# 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]})
assert next(u for u in admin.call('/operator/users')['users'] if u['email'] == emails['designer'])['machines'] == []
designer = signed_in(emails['designer'])
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': ''},
expected=403)
designer.call(f'/operator/orders/{textil_o}/move', {'state': 'rec', 'version': moved['version'],
'reason': 'arte trocada'})
designer.call(f'/operator/orders/{textil_o}/machine', {'machine_id': None}, expected=403)
designer.call(f'/operator/orders/{textil_o}/cancel', {'note': 'não pode'}, expected=403)
designer.call('/operator/queue/finals', expected=403)
designer.call('/operator/users', expected=403)
# Their own password: the current one is asked for.
seller.call('/operator/me/password', {'current': 'errada', 'new': 'outra-senha-de-teste'}, expected=403)
# Eight characters or more.
@@ -191,6 +209,21 @@ def run():
board = {o['id']: o for o in su.call('/operator/board', operator=True)['orders']}
assert not board[second]['machine']['chosen']
# Números per machine: an order printed for half an hour on its machine, then finished.
before = {m['id']: m for m in su.call('/operator/stats?days=7', operator=True)['machines']}
with db.connect() as c:
# A real payment: Números leaves test orders out.
c.execute('UPDATE dtf_local.orders SET payment=%s WHERE id=%s',
(Jsonb({'provider': 'mercadopago', 'id': f'users-{tag}'}), third))
for frm, to, at in (('rec', 'imp', "now()-interval '30 minutes'"), ('imp', 'fin', 'now()')):
c.execute(f'''INSERT INTO dtf_local.movements(order_id,from_state,to_state,operator,reason,back,created_at)
VALUES(%s,%s,%s,'users-test','',false,{at})''', (third, frm, to))
after = {m['id']: m for m in su.call('/operator/stats?days=7', operator=True)['machines']}
assert after[target]['orders'] == before[target]['orders'] + 1
assert after[target]['metres'] == before[target]['metres'] + 1.0
assert after[target]['last_finished'] and after[target]['metres_per_hour'] is not None
assert after[target]['printing_hours'] >= before[target]['printing_hours'] + 0.49
# Switched off, a machine gives its automatic orders to another one.
with db.connect() as c:
c.execute('UPDATE dtf_local.orders SET machine_id=%s, machine_chosen=false WHERE id=%s', (textil2, second))