[object Object]

← back to Ads Dashboard

Cycle 5 fix (Cody): expose capped flag + trend caption (net-of-refunds, order-date, shop-local) + cap-truncation warning badge

64020864376ffb141819f78f38713473fa3e8be6 · 2026-08-02 20:02:57 -0700 · Steve Abrams

Files touched

Diff

commit 64020864376ffb141819f78f38713473fa3e8be6
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Sun Aug 2 20:02:57 2026 -0700

    Cycle 5 fix (Cody): expose capped flag + trend caption (net-of-refunds, order-date, shop-local) + cap-truncation warning badge
---
 public/index.html | 3 +++
 server.js         | 1 +
 2 files changed, 4 insertions(+)

diff --git a/public/index.html b/public/index.html
index 1ac0cf7..3c1cb98 100644
--- a/public/index.html
+++ b/public/index.html
@@ -53,6 +53,7 @@
   <div class="section-h">Daily orders <span style="text-transform:none;font-weight:400">(net, last 30d)</span></div>
   <div class="card">
     <div id="trend" style="display:flex;align-items:flex-end;gap:3px;height:120px;overflow-x:auto"></div>
+    <div class="when" id="trendCap" style="margin-top:8px"></div>
     <div class="empty" id="trendEmpty" hidden></div>
   </div>
 
@@ -158,6 +159,8 @@ async function boot(){
     const max = Math.max(...tr.map(d=>d.orders), 1);
     $('trend').innerHTML = tr.map(d=>`<div title="${d.date}: ${d.orders} orders, $${d.revenue.toLocaleString()}"
       style="flex:1;min-width:8px;height:${Math.round(d.orders/max*100)}%;background:var(--accent);border-radius:3px 3px 0 0;opacity:.85"></div>`).join('');
+    $('trendCap').innerHTML = 'Revenue net of refunds, attributed to order date (shop-local, America/Los_Angeles).'
+      + (acq.capped ? ' <span class="badge" style="border-color:#c0392b;color:#c0392b">⚠ hit 250-order fetch cap — earliest days may under-report</span>' : '');
   } else { $('trend').innerHTML=''; $('trendEmpty').hidden=false; $('trendEmpty').textContent='No daily data (source: /api/acquisition).'; }
 
   // UTM campaigns (attribution)
diff --git a/server.js b/server.js
index a27d1e0..d339d63 100644
--- a/server.js
+++ b/server.js
@@ -115,6 +115,7 @@ async function fetchAcquisition() {
     generated_at: new Date().toISOString(),
     window: capped ? `${from} → ${to} (capped at 250 orders — window may be shorter than ${WINDOW_DAYS}d)` : `${from} → ${to} (last ${WINDOW_DAYS}d)`,
     totals: { orders: orders.length, revenue: round2(revenue), utm_tagged: utmTagged, refunded_netted: refundedCount },
+    capped, // true if the fetch hit the 250-order cap — trend tail may under-report
     channels, campaigns, trend, by_source: bySource,
   };
   _acqCache = { at: Date.now(), data };

← f15240c Cycle 5: daily orders/revenue trend (30d) in /api/acquisitio  ·  back to Ads Dashboard  ·  Cycle 8: rewire headline KPIs to real acquisition data (orde 55fe441 →