Populate team_name in PracticeScheduleResponse from Team join #341
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/basketball-api#341
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Type
Bug
User Story
story:WS-S13As an admin, I want to view and manage the program schedule so that I have a single source of truth for all planned activities.What Broke
GET /public/schedulereturns practices withoutteam_name. ThePracticeScheduleResponsePydantic model inschedule.pyhas noteam_namefield. The frontend relies onteam_namefor grouping practices by team — without it, practices display as individual cards instead of grouped by team.Repro Steps
curl /public/schedule | jq '.practices[] | {team_id, label}'team_idvalues but noteam_namein the responselabelproducing 4 cards instead of 2Expected Behavior
team_namefield added toPracticeScheduleResponseand populated fromTeam.namevia theteam_idFK join.Environment
basketball-api,
/public/scheduleand/admin/scheduleendpointsLineage
story:WS-S13arch:basketball-apiRepo
forgejo_admin/basketball-apiContext
Discovered by Playwright validation agent testing PR #216. The
PracticeSchedulemodel has ateamrelationship but_practice_to_response()doesn't use it, andPracticeScheduleResponsehas noteam_namefield.File Targets
src/basketball_api/routes/schedule.pylines 39-50: Addteam_name: str | None = NonetoPracticeScheduleResponsesrc/basketball_api/routes/schedule.py_practice_to_response(): Populateteam_namefrompractice.team.name if practice.team else Nonesrc/basketball_api/routes/public.pyquery: Addjoinedload(PracticeSchedule.team)to eager load the team relationshipAcceptance Criteria
PracticeScheduleResponseincludesteam_name: str | NonefieldGET /public/schedulereturnsteam_namepopulated from Team.name for every practice with a team_idteam_name: nullTest Expectations
curl /public/schedule | jq '.practices[0].team_name'returns a non-null stringConstraints
team_nametoPracticeScheduleResponse/admin/schedule) uses the same_practice_to_response()helper — both benefit from this fixChecklist
team_name: str | None = NonetoPracticeScheduleResponseinschedule.pyteam_namein_practice_to_response()frompractice.team.namejoinedload(PracticeSchedule.team)to public schedule query inpublic.pyjoinedload(PracticeSchedule.team)to admin schedule query inschedule.pyif not presentRelated
Scope Review: NEEDS_REFINEMENT
Review note:
review-827-2026-04-04PracticeScheduleResponseschema does not have ateam_namefield — the Constraints section incorrectly says "just populate the existing field." The schema must be changed to addteam_name: str | None = None.team_namefield toPracticeScheduleResponse)schedule.pyline 49team_name: str | None = NonetoPracticeScheduleResponse"arch-basketball-api(missing from pal-e-docs)Scope refinement (2026-04-05)
Addressed review-827 findings:
PracticeScheduleResponseneedsteam_name: str | None = Noneadded — corrected in Constraints and Checklistschedule.pylines 39-50 (schema) +_practice_to_response()(population) +public.py(joinedload)EventResponsehas same pattern (no team_name) — separate ticket if neededScope Review: READY
Review note:
review-827-2026-04-04Re-review passed. All three refinement issues from initial review are resolved: schema change acknowledged, file targets have explicit line numbers, checklist includes schema step. Ticket is actionable for agent dispatch.
Validation: PASS
Tiers executed: Tier 1 (local), Tier 3 (production)
Validation note:
validation-341-2026-04-047 checks: 7 PASS, 0 FAIL
/public/schedulereturns team_name from Team.name (17/17 practices)ps.team.name if ps.team else Nonejoinedload(PracticeSchedule.team)in public.py + schedule.pybbe2de0matches merge commitRegression check:
/public/teams200,/public/schedule200,/docs200. 684 non-email tests pass.Discovered (pre-existing): 6 email test files have broken imports from prior refactors — not caused by this PR.