";
}
}
+// The co-op total spans the members AND the co-op's own (operator) accounts —
+// spend_usd is the whole co-op. operator_spend_usd is the co-op's own share of
+// it (NULL where a day was not measured, so it is skipped rather than counted
+// as zero). Both summed over the widest range the series carries (all time).
+function renderCoopTotals() {
+ let total = 0, own = 0;
+ (trendsData || []).forEach(row => {
+ if (typeof row.spend_usd === "number") total += row.spend_usd;
+ if (typeof row.operator_spend_usd === "number") own += row.operator_spend_usd;
+ });
+ $("coop-total").textContent = fmtMoney(total);
+ $("coop-own").textContent = fmtMoney(own);
+}
+
function setTrendMetric(m) {
trendMetric = m;
$("tm-members").className = "mode-btn" + (m === "members" ? " active" : "");