From 6d1f97f5bd12b7385251ed00f773169ffd00dcdf Mon Sep 17 00:00:00 2001 From: moritsbw-cpu Date: Sun, 15 Nov 2026 12:35:51 +0000 Subject: [PATCH] Best week: colour only differences of 3+ points, say so when weeks are nearly equal Co-Authored-By: Claude Opus 5.5 --- src/web/index.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/web/index.html b/src/web/index.html index 9ae8758..c4d60f8 100644 --- a/src/web/index.html +++ b/src/web/index.html @@ -480,11 +480,13 @@ async function loadBest() { const max = Math.max(...vals), min = Math.min(...vals), avg = vals.reduce((s, v) => s + v, 0) / (vals.length || 1); const best = b.weeks.find(x => val(x) === max); // like a fare calendar: green = among the best weeks for this artist, red = among the worst - const level = v => { if (v == null || max === min) return 2; const z = (v - min) / (max - min); return z >= 0.85 ? 0 : z >= 0.5 ? 1 : z >= 0.2 ? 2 : 3; }; + // Colour only real differences: under 3 percentage points across the calendar, the weeks are equal. + const spread = max - min; + const level = v => { if (v == null || spread < 0.03) return 2; const z = (v - min) / spread; return z >= 0.85 ? 0 : z >= 0.5 ? 1 : z >= 0.2 ? 2 : 3; }; $('bw-out').innerHTML = vals.length ? `

${esc(b.name)}

- Best week: ${fmtDate(best.week)} · ${pct(max)} chance DR adds a new song within ${w} weeks${ch === 'any' ? '' : ' on ' + ch} (average over the calendar ${pct(avg)}).
-
${b.weeks.map(x => { const v = val(x); return `
+ ${spread < 0.03 ? `The weeks are nearly equal (within ${Math.max(1, Math.round(spread * 100))} percentage points): about ${pct(avg)} chance DR adds a new song within ${w} weeks${ch === 'any' ? '' : ' on ' + ch}, whichever week (outside the "too soon" weeks).` : `Best week: ${fmtDate(best.week)} · ${pct(max)} chance DR adds a new song within ${w} weeks${ch === 'any' ? '' : ' on ' + ch} (worst ${pct(min)}, average ${pct(avg)}).`}
+
${b.weeks.map(x => { const v = val(x); return `
Week of ${fmtDate(x.week)}
${x.too_soon ? 'too soon' : pct(v)}
${x.christmas ? '🎄' : ''}
`; }).join('')}

Each tile: if ${esc(b.name)} releases a new song that week, the chance DR puts it into rotation within ${w} weeks. ${b.last_release ? `Their last release: ${fmtDate(b.last_release)}; weeks less than 6 weeks after it are "too soon" (the model only learned from releases with a clear gap).` : ''} The new song's NMF Denmark placement: ${nmf === 'auto' ? `as often as their releases were placed (${pct(b.p_nmf)})` : nmf === 'yes' ? 'placed' : 'not placed'}. What moves the numbers from week to week: time since their last release and last DR add, Christmas, and their NMF history; their current airplay is taken as it is now.

` : `

${esc(b.name)}

No week in the next 26 has an estimate.

`;