feat: a Números tab with the production numbers the board already records

Every paid order and every move is recorded, but nobody could see the
totals. The new tab shows, for the last 7, 30 or 90 days: paid orders,
metres sold, money received, the average ticket, how many orders needed a
correction, and the median time from payment to Finalizado. A column per
day charts the metres sold (with a table under it), and a table gives each
stage's median time and what waits in it now, with the oldest order.
Test and cancelled orders stay out.

The header now has five tabs: the search box narrows first, the refresh
picker keeps its width, and the operator's e-mail moves to Sair's tooltip
on narrower screens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-05 12:01:03 -03:00
parent f567e6da89
commit 1b445f0459
5 changed files with 183 additions and 10 deletions

View File

@@ -113,7 +113,20 @@ def run():
board = client.call('/operator/board', operator=True)
assert str(uid) in board['thumbnails']
print('PASS: artwork pictures (owner only, images only), quote filters and the order/quote search')
# Numbers count real paid orders only: this test order counts once it is not one.
before = client.call('/operator/stats?days=7', operator=True)
with db.connect() as c:
c.execute("UPDATE dtf_local.orders SET payment=%s WHERE id=%s",
(Jsonb({'provider': 'mercadopago', 'id': f'kanban-{tag}'}), order_id))
after = client.call('/operator/stats?days=7', operator=True)
assert len(after['daily']) == 7
assert (after['orders'], after['cents']) == (before['orders'] + 1, before['cents'] + 1490), (before, after)
assert after['daily'][-1]['orders'] == before['daily'][-1]['orders'] + 1
assert after['waiting']['rec']['orders'] == before.get('waiting', {}).get('rec', {}).get('orders', 0) + 1
client.call('/operator/stats?days=3', operator=True, expected=422)
Client().call('/operator/stats', expected=401)
print('PASS: artwork pictures (owner only, images only), quote filters, the order/quote search and the numbers')
finally:
with db.connect() as c:
c.execute('DELETE FROM dtf_local.orders WHERE id=%s', (order_id,))