feat: Números measures the site and the Prumo (0.12)

The browser records page load, upload speed and bytes, Prumo's check and
the loose-art montage; the quote keeps them and Números shows average and
p95 per period. Print generation and the payment-to-card time come from
the database. The upload bar already estimates its remaining time.
This commit is contained in:
Cauê Faleiros
2026-11-06 11:09:36 -03:00
parent 945c9e366a
commit 6351a094f4
11 changed files with 170 additions and 3 deletions

View File

@@ -2561,6 +2561,17 @@ async function loadStats(){
tr.append(name,node('td',st?duration(st.median_hours):'—','r strong'),
node('td',now?plural(now.orders,'pedido','pedidos')+', o mais antigo há '+duration(now.oldest_hours):'nenhum','muted'));
return tr;}));
// Speed (item 0.12): average and p95 of what the customer feels.
const secs=v=>v==null?'—':v<60?Math.max(1,Math.round(v))+' s':Math.round(v/60)+' min';
const speedFmt=s=>s.unit==='MB/s'
? (v=>v==null?'—':v.toFixed(1).replace('.',',')+' MB/s')
: (v=>s.unit==='s'?secs(v):String(v));
$('stats-speed').replaceChildren(...(data.speed||[]).map(s=>{
const tr=node('tr'),fmt=speedFmt(s);
tr.append(node('td',s.label),node('td',fmt(s.average),'r'),node('td',fmt(s.p95),'r'),
node('td',String(s.samples),'r'));
if(!s.samples)tr.classList.add('off');
return tr;}));
}
const emptyRow=(text,span)=>{const tr=node('tr');const td=node('td',text,'empty');td.colSpan=span;tr.append(td);return tr;};
// Metres per day: one series of columns from one baseline, the period's