fix: filter teams by division field from API response #156

Merged
forgejo_admin merged 1 commit from 155-fix-teams-filter-division into main 2026-03-28 21:40:05 +00:00

Summary

  • Teams page filtered on t.program/t.gender but API returns t.division
  • All teams failed filter → empty page despite 7 teams returned
  • Changed to t.division === 'boys' / t.division === 'girls'

Closes #155

Test Plan

  • Kings tab shows boys division teams (4 teams)
  • Queens tab shows girls division teams (3 teams)
  • Player rosters render within each team card
## Summary - Teams page filtered on `t.program`/`t.gender` but API returns `t.division` - All teams failed filter → empty page despite 7 teams returned - Changed to `t.division === 'boys'` / `t.division === 'girls'` Closes #155 ## Test Plan - [ ] Kings tab shows boys division teams (4 teams) - [ ] Queens tab shows girls division teams (3 teams) - [ ] Player rosters render within each team card
fix: filter teams by division field from API response
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
5e7f0089a2
The frontend filtered on t.program/t.gender but the API returns
t.division ('boys'/'girls'). All teams failed the filter, rendering
the page empty despite 7 teams being returned.

Closes #155

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

PR #156 Review

DOMAIN REVIEW

Tech stack: SvelteKit 5 (Svelte runes -- $derived, $state), vanilla CSS, public-facing teams page.

Fix correctness: The diff changes two filter expressions on lines 65-66 from:

t.program === 'kings' || t.gender === 'boys'
t.program === 'queens' || t.gender === 'girls'

to:

t.division === 'boys'
t.division === 'girls'

This is correct. The API returns team objects with a division field ("boys" / "girls"), not program or gender. The old filter matched on nonexistent properties, so every team failed the predicate and both tabs rendered empty. The fix aligns the filter with the actual API response shape.

Codebase consistency verified: Searched the entire src/ tree for t.program, t.gender, team.program, team.gender -- zero remaining references. The rest of the codebase (admin teams page, player detail, registration, jersey page) already uses division consistently. This was the only stale reference.

Note on program in interest form (line 34): The program: programStore.value in the interest form POST body is intentionally program -- it sends the UI toggle value ('kings' / 'queens'), not the API's division field. This is correct and unrelated to the bug.

Scope: 1 file changed, 2 additions, 2 deletions. Minimal, surgical fix. No scope creep.

BLOCKERS

None.

This is a 2-line bugfix correcting a data property name mismatch. No new functionality is introduced, so the BLOCKER criteria (test coverage for new functionality, input validation, secrets, DRY violations) do not apply. The existing page structure, rendering logic, and API call are all unchanged.

NITS

None. The fix is clean and minimal.

SOP COMPLIANCE

  • Branch named after issue: 155-fix-teams-filter-division follows {issue-number}-{kebab-case-purpose} convention
  • PR body follows template: Summary, Test Plan present. Changes section implicit in Summary (acceptable for a 2-line fix)
  • PR body references issue: Closes #155
  • No secrets committed
  • No unnecessary file changes (single file, 2 lines)
  • Commit message is descriptive: fix: filter teams by division field from API response

Missing from PR body: ## Related section with plan slug. For a standalone bugfix with no parent plan, this is acceptable.

PROCESS OBSERVATIONS

  • Change failure risk: Very low. This is a read-path-only fix to a client-side filter predicate. No API changes, no state mutations, no auth paths affected.
  • Root cause: The original code was written against an assumed API schema (program/gender) that did not match the actual response (division). This is a common integration bug -- worth considering TypeScript interfaces or JSDoc type definitions for API response shapes to catch these at dev time.

VERDICT: APPROVED

## PR #156 Review ### DOMAIN REVIEW **Tech stack:** SvelteKit 5 (Svelte runes -- `$derived`, `$state`), vanilla CSS, public-facing teams page. **Fix correctness:** The diff changes two filter expressions on lines 65-66 from: ```js t.program === 'kings' || t.gender === 'boys' t.program === 'queens' || t.gender === 'girls' ``` to: ```js t.division === 'boys' t.division === 'girls' ``` This is correct. The API returns team objects with a `division` field (`"boys"` / `"girls"`), not `program` or `gender`. The old filter matched on nonexistent properties, so every team failed the predicate and both tabs rendered empty. The fix aligns the filter with the actual API response shape. **Codebase consistency verified:** Searched the entire `src/` tree for `t.program`, `t.gender`, `team.program`, `team.gender` -- zero remaining references. The rest of the codebase (admin teams page, player detail, registration, jersey page) already uses `division` consistently. This was the only stale reference. **Note on `program` in interest form (line 34):** The `program: programStore.value` in the interest form POST body is intentionally `program` -- it sends the UI toggle value (`'kings'` / `'queens'`), not the API's `division` field. This is correct and unrelated to the bug. **Scope:** 1 file changed, 2 additions, 2 deletions. Minimal, surgical fix. No scope creep. ### BLOCKERS None. This is a 2-line bugfix correcting a data property name mismatch. No new functionality is introduced, so the BLOCKER criteria (test coverage for new functionality, input validation, secrets, DRY violations) do not apply. The existing page structure, rendering logic, and API call are all unchanged. ### NITS None. The fix is clean and minimal. ### SOP COMPLIANCE - [x] Branch named after issue: `155-fix-teams-filter-division` follows `{issue-number}-{kebab-case-purpose}` convention - [x] PR body follows template: Summary, Test Plan present. Changes section implicit in Summary (acceptable for a 2-line fix) - [x] PR body references issue: `Closes #155` - [x] No secrets committed - [x] No unnecessary file changes (single file, 2 lines) - [x] Commit message is descriptive: `fix: filter teams by division field from API response` Missing from PR body: `## Related` section with plan slug. For a standalone bugfix with no parent plan, this is acceptable. ### PROCESS OBSERVATIONS - **Change failure risk:** Very low. This is a read-path-only fix to a client-side filter predicate. No API changes, no state mutations, no auth paths affected. - **Root cause:** The original code was written against an assumed API schema (`program`/`gender`) that did not match the actual response (`division`). This is a common integration bug -- worth considering TypeScript interfaces or JSDoc type definitions for API response shapes to catch these at dev time. ### VERDICT: APPROVED
forgejo_admin deleted branch 155-fix-teams-filter-division 2026-03-28 21:40:05 +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
forgejo_admin/westside-landing!156
No description provided.