Bug: player profile page doesn't display parent phone number #203

Closed
opened 2026-04-03 15:52:49 +00:00 by forgejo_admin · 1 comment
Contributor

Type

Bug

Lineage

Standalone — discovered during admin CRM audit (2026-04-03). Companion to basketball-api#276.

Repo

forgejo_admin/westside-landing

What Broke

The player profile page (/players/[id]) has template code to display parent phone, email, and name. However the API returns these nested as parent.phone, parent.email, parent.name while the template accesses flat player.parent_phone, player.parent_email, player.parent_name.

Line 56 in src/routes/(app)/players/[id]/+page.svelte assigns raw API response directly to player with no field mapping. All three parent fields are undefined with real data:

  • player.parent_phone (line 540) — never renders
  • player.parent_email (line 546) — never renders
  • player.parent_name (line 76 fallback) — never renders

The mock data (line 45) uses flat shape which is why demo mode works.

Repro Steps

  1. Log in as admin (marcusdraney23@gmail.com) at https://westsidekingsandqueens.tail5b443a.ts.net
  2. Navigate to CRM → click Aleiyah Apaisa (player 111)
  3. Scroll to "Admin Actions" card
  4. Observe: no Parent Contact phone, no Parent Email — despite DB having phone 3852329501 and email apaisasandra@gmail.com

Screenshot evidence: apaisa-profile-no-phone.png

Expected Behavior

Admin Actions card should show "Parent Contact" with clickable tel: link and "Parent Email" when parent data exists in the API response.

Environment

  • Cluster/namespace: prod / westside-landing (served via westsidekingsandqueens Tailscale funnel)
  • Service version: current deployment
  • Related alerts: none — UI rendering gap, not crash

File Targets

Files to modify:

  • src/routes/(app)/players/[id]/+page.svelte — after the apiFetch at line 56, add mapping:
    // Map nested parent fields to flat fields expected by template
    if (player.parent) {
        player.parent_name = player.parent.name || '';
        player.parent_phone = player.parent.phone || '';
        player.parent_email = player.parent.email || '';
    }
    

Files NOT to touch:

  • src/routes/(app)/admin/players/+page.svelte — CRM list uses different endpoint (separate ticket basketball-api#276)
  • src/routes/(app)/coach/+page.svelte — coach roster uses its own data shape, already works

Acceptance Criteria

  • Player profile page shows "Parent Contact" with clickable phone link in Admin Actions card when logged in as admin
  • Player profile page shows "Parent Email" in Admin Actions card
  • Phone displays for Aleiyah Apaisa (player 111) as 3852329501
  • Parent name and email still display correctly
  • Mock player (id 999) still renders correctly
  • Coach roster view (/coach) still works (uses its own data shape)
  • project-westside-basketball
  • Companion: forgejo_admin/basketball-api#276 (adds parent_phone to admin list endpoint — independent fix, different code path)
### Type Bug ### Lineage Standalone — discovered during admin CRM audit (2026-04-03). Companion to basketball-api#276. ### Repo `forgejo_admin/westside-landing` ### What Broke The player profile page (`/players/[id]`) has template code to display parent phone, email, and name. However the API returns these nested as `parent.phone`, `parent.email`, `parent.name` while the template accesses flat `player.parent_phone`, `player.parent_email`, `player.parent_name`. Line 56 in `src/routes/(app)/players/[id]/+page.svelte` assigns raw API response directly to `player` with no field mapping. All three parent fields are `undefined` with real data: - `player.parent_phone` (line 540) — never renders - `player.parent_email` (line 546) — never renders - `player.parent_name` (line 76 fallback) — never renders The mock data (line 45) uses flat shape which is why demo mode works. ### Repro Steps 1. Log in as admin (marcusdraney23@gmail.com) at https://westsidekingsandqueens.tail5b443a.ts.net 2. Navigate to CRM → click Aleiyah Apaisa (player 111) 3. Scroll to "Admin Actions" card 4. Observe: no Parent Contact phone, no Parent Email — despite DB having phone `3852329501` and email `apaisasandra@gmail.com` Screenshot evidence: `apaisa-profile-no-phone.png` ### Expected Behavior Admin Actions card should show "Parent Contact" with clickable `tel:` link and "Parent Email" when parent data exists in the API response. ### Environment - Cluster/namespace: prod / westside-landing (served via westsidekingsandqueens Tailscale funnel) - Service version: current deployment - Related alerts: none — UI rendering gap, not crash ### File Targets Files to modify: - `src/routes/(app)/players/[id]/+page.svelte` — after the `apiFetch` at line 56, add mapping: ```js // Map nested parent fields to flat fields expected by template if (player.parent) { player.parent_name = player.parent.name || ''; player.parent_phone = player.parent.phone || ''; player.parent_email = player.parent.email || ''; } ``` Files NOT to touch: - `src/routes/(app)/admin/players/+page.svelte` — CRM list uses different endpoint (separate ticket basketball-api#276) - `src/routes/(app)/coach/+page.svelte` — coach roster uses its own data shape, already works ### Acceptance Criteria - [ ] Player profile page shows "Parent Contact" with clickable phone link in Admin Actions card when logged in as admin - [ ] Player profile page shows "Parent Email" in Admin Actions card - [ ] Phone displays for Aleiyah Apaisa (player 111) as `3852329501` - [ ] Parent name and email still display correctly - [ ] Mock player (id 999) still renders correctly - [ ] Coach roster view (`/coach`) still works (uses its own data shape) ### Related - `project-westside-basketball` - Companion: `forgejo_admin/basketball-api#276` (adds `parent_phone` to admin list endpoint — independent fix, different code path)
Author
Contributor

Scope Review: READY

Review note: review-737-2026-04-03
Scope is solid. File targets verified, traceability complete, single-agent pass.

Blast radius finding: parent_email (line 546) and parent_name (line 76 fallback) have the same nested-vs-flat mismatch as parent_phone. Fix should map all three parent fields from player.parent.{name,email,phone} to flat references. The issue body should be updated to reflect this expanded scope before dispatch.

## Scope Review: READY Review note: `review-737-2026-04-03` Scope is solid. File targets verified, traceability complete, single-agent pass. **Blast radius finding:** `parent_email` (line 546) and `parent_name` (line 76 fallback) have the same nested-vs-flat mismatch as `parent_phone`. Fix should map all three parent fields from `player.parent.{name,email,phone}` to flat references. The issue body should be updated to reflect this expanded scope before dispatch.
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
ldraney/westside-app#203
No description provided.