Frontend: fix coach profile field mapping (title→role, team_name derivation) #285

Closed
opened 2026-04-03 16:57:54 +00:00 by forgejo_admin · 2 comments

Type

Bug

Lineage

Related to forgejo_admin/basketball-api#278 (spike: audit API response contract mismatches with westside-landing frontend)

Repo

forgejo_admin/westside-landing

Note: This issue is filed on basketball-api but the work is entirely in westside-landing. The executing agent should open the PR on westside-landing.

User Story

As an admin/coach/parent, I want the coach profile page to correctly display the coach's role and team name so that information is accurate.

Context

Spike Mismatch 8: The coach profile page has two field mapping bugs:

  1. Frontend reads coach.title (line 55) but the API returns coach.role. Fix: change coach.title to coach.role.
  2. Frontend needs to derive team_name from coach.teams[0]?.name — the teams array is already available (line 95 uses coach.teams).

The API already returns the correct data (CoachProfileResponse has role, teams array). This is purely a frontend field-name fix.

File Targets

Files to modify:

  • src/routes/(app)/coaches/[id]/+page.svelte — change coach.title to coach.role (line 55). Derive team_name from coach.teams[0]?.name.

Files NOT to touch:

  • src/basketball_api/routes/coaches_api.py — API already returns correct fields

Acceptance Criteria

  • Frontend uses coach.role instead of coach.title
  • Frontend derives team_name from coach.teams[0]?.name
  • All existing tests pass

Test Expectations

  • Frontend: verify coach profile renders role and team name correctly
  • Run command: verify visually or with component test

Constraints

  • Frontend-only fix — do NOT modify basketball-api
  • PR goes to westside-landing repo
  • Priority: MEDIUM

Checklist

  • PR opened (westside-landing)
  • No unrelated changes
### Type Bug ### Lineage Related to forgejo_admin/basketball-api#278 (spike: audit API response contract mismatches with westside-landing frontend) ### Repo forgejo_admin/westside-landing **Note**: This issue is filed on basketball-api but the work is entirely in westside-landing. The executing agent should open the PR on westside-landing. ### User Story As an admin/coach/parent, I want the coach profile page to correctly display the coach's role and team name so that information is accurate. ### Context Spike Mismatch 8: The coach profile page has two field mapping bugs: 1. **Frontend** reads `coach.title` (line 55) but the API returns `coach.role`. Fix: change `coach.title` to `coach.role`. 2. **Frontend** needs to derive `team_name` from `coach.teams[0]?.name` — the teams array is already available (line 95 uses `coach.teams`). The API already returns the correct data (`CoachProfileResponse` has `role`, `teams` array). This is purely a frontend field-name fix. ### File Targets Files to modify: - `src/routes/(app)/coaches/[id]/+page.svelte` — change `coach.title` to `coach.role` (line 55). Derive `team_name` from `coach.teams[0]?.name`. Files NOT to touch: - `src/basketball_api/routes/coaches_api.py` — API already returns correct fields ### Acceptance Criteria - [ ] Frontend uses `coach.role` instead of `coach.title` - [ ] Frontend derives `team_name` from `coach.teams[0]?.name` - [ ] All existing tests pass ### Test Expectations - Frontend: verify coach profile renders role and team name correctly - Run command: verify visually or with component test ### Constraints - Frontend-only fix — do NOT modify basketball-api - PR goes to westside-landing repo - Priority: MEDIUM ### Checklist - [ ] PR opened (westside-landing) - [ ] No unrelated changes ### Related - Spike: forgejo_admin/basketball-api#278 (Mismatch 8) - API reference: `src/basketball_api/routes/coaches_api.py` (CoachProfileResponse already has role + teams)
Author
Owner

Scope Review: NEEDS_REFINEMENT

Review note: review-745-2026-04-03
Repo placement mismatch and scope ambiguity need resolution.

  • [BODY] Fix frontend file path: src/routes/coaches/[id]/+page.svelte should be src/routes/(app)/coaches/[id]/+page.svelte
  • [BODY] Move issue to westside-landing repo — primary work is a frontend fix (coach.title -> coach.role), but issue is filed on basketball-api.
  • [BODY] Remove "(Optional)" API AC (photo_url, bio) — creates ambiguity for executing agent. Split to separate ticket if desired.
  • [SCOPE] Create architecture note arch-westside-app
## Scope Review: NEEDS_REFINEMENT Review note: `review-745-2026-04-03` Repo placement mismatch and scope ambiguity need resolution. - `[BODY]` Fix frontend file path: `src/routes/coaches/[id]/+page.svelte` should be `src/routes/(app)/coaches/[id]/+page.svelte` - `[BODY]` Move issue to westside-landing repo — primary work is a frontend fix (coach.title -> coach.role), but issue is filed on basketball-api. - `[BODY]` Remove "(Optional)" API AC (photo_url, bio) — creates ambiguity for executing agent. Split to separate ticket if desired. - `[SCOPE]` Create architecture note arch-westside-app
forgejo_admin changed title from Fix coach profile page: role field mapping + optional photo_url/bio to Frontend: fix coach profile field mapping (title→role, team_name derivation) 2026-04-03 17:47:33 +00:00
Author
Owner

Scope Review: APPROVED (re-review after refinement)

Review note: review-745-2026-04-03-v2
Issue re-scoped: removed optional API photo_url/bio, fixed file path to include (app) route group, re-typed as Bug (field mapping fix). Issue remains on basketball-api but body explicitly directs PR to westside-landing. 1 file, 3 AC, <5 min.

  • [SCOPE] Create architecture note arch-westside-app (deferred — does not block execution)
## Scope Review: APPROVED (re-review after refinement) Review note: `review-745-2026-04-03-v2` Issue re-scoped: removed optional API photo_url/bio, fixed file path to include (app) route group, re-typed as Bug (field mapping fix). Issue remains on basketball-api but body explicitly directs PR to westside-landing. 1 file, 3 AC, <5 min. - [SCOPE] Create architecture note arch-westside-app (deferred — does not block execution)
Sign in to join this conversation.
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/basketball-api#285
No description provided.