fix: Atrasados lists production stages and real orders only (front 11)
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Successful in 4m27s
Build and deploy / Publish images (push) Successful in 1m6s
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Successful in 4m27s
Build and deploy / Publish images (push) Successful in 1m6s
A delivery is done when it leaves and a test card is not production. Only pickup orders waiting in Finalizado can be late, and the top strip now shows working columns; the finished pickup keeps its card colour and its place in Números.
This commit is contained in:
@@ -245,10 +245,15 @@ def assign_late(c, orders, limits):
|
||||
entered[(str(row['order_id']), row['to_state'])] = row['created_at']
|
||||
now = datetime.now(timezone.utc)
|
||||
for order in orders:
|
||||
if order.get('cancelled_at'):
|
||||
if order.get('cancelled_at') or payments.is_test(order):
|
||||
continue
|
||||
limit = limits.get(order['state'])
|
||||
if not limit or (order['state'] == 'fin' and order.get('picked_up_at')):
|
||||
if not limit:
|
||||
continue
|
||||
# Finalizado only has a pickup deadline; a delivery is done when it
|
||||
# leaves, and a collected order is not waiting for anyone.
|
||||
if order['state'] == 'fin' and (order.get('picked_up_at') or
|
||||
not receipt.is_pickup(order['snapshot'])):
|
||||
continue
|
||||
since = entered.get((str(order['id']), order['state']))
|
||||
if not since and order['state'] == 'fin':
|
||||
|
||||
@@ -22,7 +22,9 @@ def run():
|
||||
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,))
|
||||
c.execute("""UPDATE dtf_local.orders SET created_at=now()-interval '3 hours',
|
||||
payment=%s WHERE id=%s""",
|
||||
(Jsonb({'provider': 'mercadopago', 'id': str(order)}), order))
|
||||
try:
|
||||
board = client.call('/operator/board', operator=True)
|
||||
mine = next(o for o in board['orders'] if o['id'] == str(order))
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
<h3>Da casa, por quem imprimiu</h3>
|
||||
<table class="table"><tbody id="stats-rework-printers"></tbody></table>
|
||||
<h3>Aguardando autorização</h3><ul class="plainlist" id="stats-rework-pending"></ul></details></section>
|
||||
<section class="panel clip s6"><div class="phead"><h2>Tempo em cada etapa</h2><span class="hint tip-l" tabindex="0" data-tip="Tempo mediano por pedido: quem voltou para a etapa soma cada passagem. O tempo em Aguardando contato não conta."><svg class="i s" viewBox="0 0 20 20" aria-hidden="true"><path d="M2.75 10a7.25 7.25 0 1 0 14.5 0a7.25 7.25 0 1 0 -14.5 0 M10 9v4.5 M10 6.25v.75"></path></svg></span></div>
|
||||
<section class="panel clip s6"><div class="phead"><h2>Tempo em cada etapa</h2><span class="hint tip-l" tabindex="0" data-tip="Tempo mediano por pedido: quem voltou para a etapa soma cada passagem. O tempo em Aguardando contato não conta."><svg class="i s" viewBox="0 0 20 20" aria-hidden="true"><path d="M2.75 10a7.25 7.25 0 1 0 14.5 0a7.25 7.25 0 1 0 -14.5 0 M10 9v4.5 M10 6.25v.75"></path></svg></span><button class="btn right" id="edit-stage-limits" type="button" hidden>Editar tempos</button></div>
|
||||
<table class="table"><thead><tr><th scope="col">Etapa</th><th scope="col" class="r">Mediana</th><th scope="col" class="r">Aceitável</th><th scope="col" class="r">Estouros</th><th scope="col">Agora</th></tr></thead><tbody id="stats-stages"></tbody></table></section>
|
||||
</div>
|
||||
<section class="panel clip"><div class="phead"><h2>Velocidade do site e do Prumo</h2><span class="hint tip-l" tabindex="0" data-tip="Média e p95 do que o cliente sente, por pedido pago no período: abrir a página, subir o arquivo (MB/s), a conferência do Prumo, a montagem das avulsas, a geração do arquivo final por 10 m e o tempo do evento de pagamento até o card. Referências: página < 3 s; conferência < 30 s; geração < 2 min por 10 m; card em até 1 min."><svg class="i s" viewBox="0 0 20 20" aria-hidden="true"><path d="M2.75 10a7.25 7.25 0 1 0 14.5 0a7.25 7.25 0 1 0 -14.5 0 M10 9v4.5 M10 6.25v.75"></path></svg></span></div>
|
||||
|
||||
@@ -846,7 +846,10 @@ let phoneCol='rec';
|
||||
// responsible for that column, above the board.
|
||||
function renderLatebar(){
|
||||
const bar=$('latebar');
|
||||
const late=board.orders.filter(o=>!o.cancelled_at&&o.late)
|
||||
// The top strip is for production delays. A pickup waiting in Finalizado
|
||||
// keeps its yellow/red card and is counted in Números; it does not push
|
||||
// every historical finished order across the top of the board.
|
||||
const late=board.orders.filter(o=>!o.cancelled_at&&!isTest(o)&&o.late&&o.state!=='fin')
|
||||
.sort((a,b)=>(b.state_hours||0)-(a.state_hours||0));
|
||||
if(!late.length){bar.hidden=true;bar.replaceChildren();return;}
|
||||
bar.hidden=false;
|
||||
@@ -2545,6 +2548,8 @@ function calendar(){
|
||||
}
|
||||
async function loadStats(){
|
||||
const data=await api('/stats?'+(statsRange?'start='+statsRange.start+'&end='+statsRange.end:'days='+statsDays));
|
||||
const editLimits=$('edit-stage-limits');
|
||||
if(editLimits){editLimits.hidden=!may('manage');editLimits.onclick=()=>stageLimitsDialog();}
|
||||
statsData=data;statsPeriod();
|
||||
$('stats-note').textContent='Pedidos pagos de '+dayLabel(data.start)+' a '+dayLabel(data.end)+', sem testes e cancelados';
|
||||
const hk=(label,value,unit,note)=>{const k=node('div',undefined,'hk');const b=node('b',value);if(unit)b.append(node('small',unit));
|
||||
|
||||
Reference in New Issue
Block a user