fix(adwright overview): show 0 (not —) when data empty; was treating zero as 'missing'
Some checks failed
plugin-tests / test (push) Failing after 6s

Bug: cycleCount: String(c.length || '—') turned 0 into '—' due to || falsy
coercion. Plan B DB starts empty → Overview KPIs all '—' even after a
successful refresh. Renders '0' now (the actually correct truthful value).

Karpathy 4 rules: smallest change (one expression), no shape change.
This commit is contained in:
Svrnty 2026-05-24 14:45:20 -04:00
parent 058d67b459
commit ef6a123c06

View File

@ -322,12 +322,12 @@
const ctrs = c.map((x) => x.ctr || 0).filter((v) => v > 0); const ctrs = c.map((x) => x.ctr || 0).filter((v) => v > 0);
const ctr = ctrs.length ? (ctrs.reduce((s, x) => s + x, 0) / ctrs.length) : 0; const ctr = ctrs.length ? (ctrs.reduce((s, x) => s + x, 0) / ctrs.length) : 0;
return { return {
impressions: impressions ? _abbrev(impressions) : "", impressions: impressions ? _abbrev(impressions) : "0",
imprDelta: impressions ? "+12%" : "", imprDelta: impressions ? "+12%" : "",
ctr: ctr ? (ctr.toFixed(2) + "%") : "", ctr: ctr ? (ctr.toFixed(2) + "%") : "0%",
ctrDelta: ctr ? "-0.3%" : "", ctrDelta: ctr ? "-0.3%" : "",
cycleCount: String(c.length || "—"), cycleCount: String(c.length),
recipeCount: String(r.length || "—"), recipeCount: String(r.length),
spend: spend, spend: spend,
budget: budget, budget: budget,
}; };