feat: acceptable time per stage with late cards and alerts (front 11)
All checks were successful
Build and deploy / Validate source (push) Successful in 4s
Build and deploy / Integration suite on a real stack (push) Successful in 4m24s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m0s

Gestão edits the hours and the responsible for each column. A card past the
limit turns yellow, twice the limit red, and the board lists it under
Atrasados. Números compares the real median with the limit and counts the
passages that exceeded it in the period and today.
This commit is contained in:
Cauê Faleiros
2026-11-06 12:52:53 -03:00
parent 7e22262280
commit bdff73b76b
7 changed files with 216 additions and 9 deletions

View File

@@ -0,0 +1,46 @@
"""Acceptable time per stage: Gestão edits it, the board marks the late cards."""
from uuid import uuid4
from psycopg.types.json import Jsonb
from app.core import db
from tests.smoke_test import Client
from tests.users_test import order_fixture
def run():
client = Client()
client.call('/session')
defaults = [{'state': 'rec', 'hours': 2, 'responsible': 'Designer'},
{'state': 'tra', 'hours': 6, 'responsible': 'Operador'},
{'state': 'imp', 'hours': 4, 'responsible': 'Operador'},
{'state': 'rev', 'hours': 2, 'responsible': 'Revisor'},
{'state': 'fin', 'hours': 72, 'responsible': 'Atendimento'}]
seen = client.call('/operator/stage-limits', operator=True)['limits']
assert {row['state'] for row in seen} == {'rec', 'tra', 'imp', 'rev', 'fin'}, seen
client.call('/operator/stage-limits', {'limits': defaults}, operator=True)
owner = uuid4()
with db.connect() as c:
quote, order = order_fixture(c, owner, 'file')
c.execute("UPDATE dtf_local.orders SET created_at=now()-interval '3 hours' WHERE id=%s", (order,))
try:
board = client.call('/operator/board', operator=True)
mine = next(o for o in board['orders'] if o['id'] == str(order))
assert mine['late'] == 'warn' and mine['limit_hours'] == 2, mine
assert board['stage_limits']['rec'] == {'hours': 2.0, 'responsible': 'Designer'}, board['stage_limits']
faster = [row for row in defaults if row['state'] != 'rec'] + [
{'state': 'rec', 'hours': 1, 'responsible': 'Designer'}]
client.call('/operator/stage-limits', {'limits': faster}, operator=True)
board = client.call('/operator/board', operator=True)
mine = next(o for o in board['orders'] if o['id'] == str(order))
assert mine['late'] == 'bad' and mine['limit_hours'] == 1, mine
print('PASS: stage limits are editable and a card past the limit is yellow/red')
finally:
client.call('/operator/stage-limits', {'limits': defaults}, operator=True)
with db.connect() as c:
c.execute('DELETE FROM dtf_local.orders WHERE id=%s', (order,))
c.execute('DELETE FROM dtf_local.quotes WHERE id=%s', (quote,))
if __name__ == '__main__':
run()