diff --git a/suite-traffic.js b/suite-traffic.js index 5da728c..60b7cd5 100644 --- a/suite-traffic.js +++ b/suite-traffic.js @@ -203,6 +203,12 @@ async function stop(memberId, adId) { // `bought` preserves the original order size so the member's history still // shows what they launched, not just what it ended up costing them. if (row.bought == null) row.bought = row.impressions; + + // A handful of rows on the network carry a `remaining` larger than their + // `assigned` (a pre-existing counter quirk). Clamp, or a member sees + // "1,002 returned" on an ad they bought 1,000 impressions for. + unserved = Math.min(unserved, row.bought); + served = row.bought - unserved; row.stopped = true; row.stoppedAt = new Date().toISOString(); row.served = served;