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)); }