feat: show all groups including unplayed, add upcoming matches per group

sync.ts: after computing standings from played matches, seed 0-0-0-0 rows
for every team in any group match, so all 12 groups always appear.

/groups: fetch all 2026 matches alongside standings; each group card now
shows results (score), live badge, and upcoming fixtures with local
kickoff time, sorted by UTC kickoff.

/tournaments/[year]: derive group list from union of standings + match
group names, so groups with no played matches still render with their
fixtures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-15 19:47:52 +02:00
parent 76425e7f76
commit 71e7e47aca
3 changed files with 139 additions and 5 deletions
+11
View File
@@ -227,6 +227,17 @@ async function run() {
goal_diff = EXCLUDED.goal_diff, pts = EXCLUDED.pts
`)
// Ensure every team that appears in a group match has a standings row (0-0-0-0 for unplayed teams)
await db.execute(sql`
INSERT INTO group_standings (tournament_year, group_name, team_id, played, won, drawn, lost, goals_for, goals_against, goal_diff, pts)
SELECT DISTINCT 2026, group_name, team1_id, 0, 0, 0, 0, 0, 0, 0, 0
FROM matches WHERE tournament_year = 2026 AND group_name IS NOT NULL AND is_quali_playoff = false
UNION
SELECT DISTINCT 2026, group_name, team2_id, 0, 0, 0, 0, 0, 0, 0, 0
FROM matches WHERE tournament_year = 2026 AND group_name IS NOT NULL AND is_quali_playoff = false
ON CONFLICT (tournament_year, group_name, team_id) DO NOTHING
`)
// Tournament aggregates
await db.execute(sql`
UPDATE tournaments SET