fix: group local teams by team_name not practice label #216

Merged
forgejo_admin merged 1 commit from 209-fix-local-teams-grouping into main 2026-04-04 21:43:00 +00:00
Contributor

Summary

Local teams section on /schedule displayed 4 cards (one per practice slot labeled "16U LOCAL KINGS MON PRACTICE") instead of 2 cards grouped by team name. Root cause: groupByTeam used p.label as the primary grouping key instead of p.team_name.

Changes

  • src/routes/(public)/schedule/+page.svelte:
    • groupByTeam: Changed grouping key from p.label || p.team_name to p.team_name || p.label so practices are grouped by team name
    • kingsTravelPractices / kingsLocalPractices filters: Changed to check p.team_name first for "Local" detection, falling back to p.label then p.group
    • groupByDay: Changed team name extraction to prefer p.team_name over regex-stripped p.label

Test Plan

  • Visit /schedule and select Kings
  • Local Teams section should show 2 cards: "16U Local Kings" and "17U Local Kings"
  • Each card lists all practice days/times/locations for that team
  • Travel Teams section unchanged (still grouped by day)
  • Queens section unchanged
  • Fallback data (API unavailable) still works correctly via team_name field in FALLBACK_PRACTICES

Review Checklist

  • svelte-check passes with 0 errors
  • Only +page.svelte modified -- no API changes
  • Travel team display unaffected
  • Queens display unaffected
  • Fallback data path still works (uses team_name field)

None.

Closes #209

## Summary Local teams section on `/schedule` displayed 4 cards (one per practice slot labeled "16U LOCAL KINGS MON PRACTICE") instead of 2 cards grouped by team name. Root cause: `groupByTeam` used `p.label` as the primary grouping key instead of `p.team_name`. ## Changes - `src/routes/(public)/schedule/+page.svelte`: - **`groupByTeam`**: Changed grouping key from `p.label || p.team_name` to `p.team_name || p.label` so practices are grouped by team name - **`kingsTravelPractices` / `kingsLocalPractices` filters**: Changed to check `p.team_name` first for "Local" detection, falling back to `p.label` then `p.group` - **`groupByDay`**: Changed team name extraction to prefer `p.team_name` over regex-stripped `p.label` ## Test Plan - Visit `/schedule` and select Kings - Local Teams section should show 2 cards: "16U Local Kings" and "17U Local Kings" - Each card lists all practice days/times/locations for that team - Travel Teams section unchanged (still grouped by day) - Queens section unchanged - Fallback data (API unavailable) still works correctly via `team_name` field in FALLBACK_PRACTICES ## Review Checklist - [x] `svelte-check` passes with 0 errors - [x] Only `+page.svelte` modified -- no API changes - [x] Travel team display unaffected - [x] Queens display unaffected - [x] Fallback data path still works (uses `team_name` field) ## Related Notes None. ## Related Closes #209
fix: group local teams by team_name instead of practice label
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
cb60cfffa1
The groupByTeam function used p.label as the primary grouping key, which
produced 4 separate cards (one per practice slot like "16U LOCAL KINGS MON
PRACTICE") instead of 2 cards grouped by team name. Changed groupByTeam,
local/travel filters, and groupByDay to prefer p.team_name over p.label,
so local teams display as "16U Local Kings" and "17U Local Kings" with all
practice days listed under each card.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Contributor

QA Review -- PR #216

Diff Analysis

1 file changed, 6 additions, 6 deletions. All changes in src/routes/(public)/schedule/+page.svelte.

Findings

Correctness -- PASS

  • groupByTeam now keys on p.team_name || p.label || 'Practice' instead of p.label || p.team_name || 'Practice'. This correctly groups all practice slots for the same team into a single card.
  • Local/travel filter now checks p.team_name first for "Local" substring, with clean three-tier fallback chain: team_name -> label -> group.
  • groupByDay team name extraction prefers p.team_name over regex-stripped p.label, producing cleaner display names in travel day cards.

Backward Compatibility -- PASS

  • Fallback data (FALLBACK_PRACTICES) has team_name fields, so the fallback path still works correctly.
  • If API returns data without team_name, falls back to label then group -- no breakage.

Scope -- PASS

  • Only local teams grouping logic changed. Queens path untouched. Travel teams still use groupByDay.
  • No API changes. Pure frontend fix.

Build Validation -- PASS

  • svelte-check passes with 0 errors (7 pre-existing warnings in unrelated files).

No issues found.


VERDICT: APPROVED

## QA Review -- PR #216 ### Diff Analysis 1 file changed, 6 additions, 6 deletions. All changes in `src/routes/(public)/schedule/+page.svelte`. ### Findings **Correctness -- PASS** - `groupByTeam` now keys on `p.team_name || p.label || 'Practice'` instead of `p.label || p.team_name || 'Practice'`. This correctly groups all practice slots for the same team into a single card. - Local/travel filter now checks `p.team_name` first for "Local" substring, with clean three-tier fallback chain: `team_name` -> `label` -> `group`. - `groupByDay` team name extraction prefers `p.team_name` over regex-stripped `p.label`, producing cleaner display names in travel day cards. **Backward Compatibility -- PASS** - Fallback data (`FALLBACK_PRACTICES`) has `team_name` fields, so the fallback path still works correctly. - If API returns data without `team_name`, falls back to `label` then `group` -- no breakage. **Scope -- PASS** - Only local teams grouping logic changed. Queens path untouched. Travel teams still use `groupByDay`. - No API changes. Pure frontend fix. **Build Validation -- PASS** - `svelte-check` passes with 0 errors (7 pre-existing warnings in unrelated files). **No issues found.** --- **VERDICT: APPROVED**
forgejo_admin deleted branch 209-fix-local-teams-grouping 2026-04-04 21:43:00 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/westside-app!216
No description provided.