From 079692c84ff1b17476d6898d0bf2e2c04a16b2cb Mon Sep 17 00:00:00 2001 From: mandalore Date: Tue, 15 Sep 2026 17:53:08 -0500 Subject: [PATCH] Fix multi-circuit events not showing all matching circuit tags BCP's leagueId query only matches an event's primary league, not every league in its own `leagues` array, so an event belonging to a second watched circuit (e.g. Show Me Showdown under both LMC 2027 and Warhammer Global Rankings 2026) never got tagged with the circuit whose query never returned it. Cross-reference ev.leagues against CONFIG.circuits to pick up those additional memberships. Co-Authored-By: Claude Sonnet 5 --- sites/events/src/main.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sites/events/src/main.js b/sites/events/src/main.js index babdc2c..03dae8b 100644 --- a/sites/events/src/main.js +++ b/sites/events/src/main.js @@ -325,6 +325,23 @@ function mergeEvents(results) { byId.get(ev.id).circuits.push(circuit); } } + // BCP's leagueId query only matches an event's single primary/owning + // league, not every league in the event's own `leagues` array — so an + // event can belong to a second watched circuit whose dedicated fetch + // never returns it. Cross-reference ev.leagues against CONFIG.circuits + // to pick up those additional memberships (still honoring `near`, since + // this bypasses the radius filter applied in load()). + for (const { event: ev, circuits } of byId.values()) { + const already = new Set(circuits.map(c => c.id)); + for (const league of ev.leagues || []) { + if (already.has(league.id)) continue; + const circuit = CONFIG.circuits.find(c => c.id === league.id); + if (circuit && withinRadius(ev, circuit.near)) { + circuits.push(circuit); + already.add(circuit.id); + } + } + } return [...byId.values()].sort((a, b) => Date.parse(a.event.eventDate) - Date.parse(b.event.eventDate)); }