fix: map nested parent fields for player profile display #204
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/westside-app!204
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "203-parent-phone-profile"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The player profile page accessed
parent_phone,parent_email, andparent_nameas flat fields on the player object, but the API returns them nested underplayer.parent. Added a mapping after the API fetch to bridge the two shapes.Changes
src/routes/(app)/players/[id]/+page.svelte-- afterapiFetch, mapplayer.parent.{name,phone,email}to flatplayer.parent_{name,phone,email}fields expected by the templateTest Plan
3852329501and Parent Emailapaisasandra@gmail.com/coach) still works (uses its own data shape, unaffected)npm run build)Review Checklist
npm run build)Related Notes
QA Review -- PR #204
Diff Analysis
src/routes/(app)/players/[id]/+page.svelte-- adds parent field mapping after API fetchFindings
Correctness: PASS
player.parent.{name,phone,email}to flatplayer.parent_{name,phone,email}fieldsif (player.parent)prevents null reference when parent data is absent|| ''matches existing error-path defaults (lines 76-78)Scope: PASS
Build: PASS
npm run buildsucceedsNits: None
VERDICT: APPROVED
PR #204 Review
DOMAIN REVIEW
Stack: SvelteKit (adapter-static), Svelte component (
+page.svelte)This is a 6-line bug fix that bridges a data shape mismatch between the API response (nested
player.parentobject) and the template (which expects flatplayer.parent_name,player.parent_phone,player.parent_emailfields).The implementation is correct:
if (player.parent)prevents errors when parent data is absent|| ''ensures the template always gets a string, avoidingundefinedrenderingapiFetchand before template render is the right spotBLOCKERS
None.
NITS
Data contract translation layer -- The root cause is a mismatch between API shape (
player.parent.name) and template shape (player.parent_name). A more durable long-term approach would be updating the template to read nested fields directly (player.parent?.name), eliminating the translation. However, that is out of scope for this bug fix and would touch more lines. Worth tracking as a follow-up if the pattern appears in other pages.Silent fallback --
|| ''will coercenull,undefined, and empty string identically. For display purposes this is fine. If downstream logic ever needs to distinguish "no parent" from "parent with empty name," this would need revisiting. Not a concern today.SOP COMPLIANCE
203-parent-phone-profile)Closes #203) and companion PR (basketball-api#276)PROCESS OBSERVATIONS
basketball-api#276) noted as independent -- good cross-repo awareness.VERDICT: APPROVED