From 54501260b4ce9cd456af6e6326c28c81e9321796 Mon Sep 17 00:00:00 2001 From: Junaid Saeed Uppal Date: Thu, 26 Feb 2026 09:29:34 +0500 Subject: [PATCH] add bettor count trend to public trend panel --- static/predictions.html | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/static/predictions.html b/static/predictions.html index c3c9c73d0..6a2dcc92e 100644 --- a/static/predictions.html +++ b/static/predictions.html @@ -581,16 +581,45 @@ function renderPublicTrend() { {chair: 'C', amount: c, pct: c/total*100}, ].sort((x, y) => y.amount - x.amount); - el.innerHTML = renderTrendBars(ranked.slice(0, 2)); + // Count unique bettors per chair + const bettorCount = {A: 0, B: 0, C: 0}; + for (const rb of Object.values(roundBettors)) { + for (const ch of CHAIRS) if ((rb.chairs[ch] || 0) > 0) bettorCount[ch]++; + } + const totalBettors = Object.keys(roundBettors).length; + const bettorRanked = CHAIRS.map(c => ({chair: c, count: bettorCount[c], pct: totalBettors > 0 ? bettorCount[c] / totalBettors * 100 : 0})) + .sort((x, y) => y.count - x.count); + + let bettorHtml = ''; + if (totalBettors > 0) { + bettorHtml = `
+
Most Bettors On
` + + bettorRanked.filter(r => r.count > 0).map((r, i) => ` +
+ ${r.chair} +
+
+
+ ${r.count} + ${r.pct.toFixed(0)}% +
`).join('') + + `
${totalBettors} total bettors
`; + } + + el.innerHTML = renderTrendBars(ranked.slice(0, 2)) + bettorHtml; // Check if public favorite matches our prediction if (currentPrediction) { const pubFav = ranked[0].chair; + const mostBettors = bettorRanked[0].chair; if (pubFav === currentPrediction) { note.textContent = `Public agrees with model pick (${pubFav})`; } else { note.textContent = `Public favors ${pubFav}, model picks ${currentPrediction} \u2014 contrarian opportunity?`; } + if (mostBettors !== pubFav) { + note.textContent += ` \u00b7 Most people on ${mostBettors} but most money on ${pubFav}`; + } } }