Add graduating_class to roster API response model #70

Closed
opened 2026-03-13 19:44:23 +00:00 by forgejo_admin · 0 comments

Lineage

plan-2026-03-08-tryout-prep → Phase 4 → Phase 4p

Repo

forgejo_admin/basketball-api

User Story

As a coach viewing the SvelteKit dashboard
I want to see each player's graduating class
So that I can evaluate age-appropriate division placement

Context

The RosterPlayer Pydantic model in the roster API is missing graduating_class. The SvelteKit dashboard reads p.graduating_class but gets undefined, showing '? on every player card. The Player SQLAlchemy model likely already has this field — the API response model just doesn't include it.

Also: the dashboard shows "Incomplete" badges based on profileComplete = !!(photo_url && position && height). Since 23/45 have no photos (files lost from ephemeral storage — separate issue 4o), this badge is misleading. The API should not include photo_url in any "completeness" logic.

File Targets

Files the agent should modify:

  • src/basketball_api/routes/tryouts.py — Add graduating_class: int | None to RosterPlayer model. Add graduating_class=p.graduating_class in the api_roster() constructor (if the field exists on the Player model). If the Player model doesn't have graduating_class, check for graduation_year or similar.
  • tests/test_tryouts.py — Add graduating_class to the test_all_fields_present expected fields set. Add a test that graduating_class is returned when populated.

Files the agent should NOT touch:

  • The SvelteKit frontend
  • Database migrations (use existing model fields only)

Acceptance Criteria

  • graduating_class appears in roster API response
  • Returns null when not set, integer when set
  • test_all_fields_present includes the new field
  • All existing tests still pass

Test Expectations

  • Run: pytest tests/test_tryouts.py -k "api_roster" -v
  • Run: pytest (full suite)

Constraints

  • Do NOT add database migrations — only use fields that already exist on the Player model
  • If graduating_class doesn't exist on the Player model, check for graduation_year or grad_year and map accordingly
  • If no graduating class field exists at all on the model, add the field to RosterPlayer as None and note it in the PR description

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • project-westside-basketball
### Lineage `plan-2026-03-08-tryout-prep` → Phase 4 → Phase 4p ### Repo `forgejo_admin/basketball-api` ### User Story As a coach viewing the SvelteKit dashboard I want to see each player's graduating class So that I can evaluate age-appropriate division placement ### Context The `RosterPlayer` Pydantic model in the roster API is missing `graduating_class`. The SvelteKit dashboard reads `p.graduating_class` but gets `undefined`, showing `'?` on every player card. The `Player` SQLAlchemy model likely already has this field — the API response model just doesn't include it. Also: the dashboard shows "Incomplete" badges based on `profileComplete = !!(photo_url && position && height)`. Since 23/45 have no photos (files lost from ephemeral storage — separate issue 4o), this badge is misleading. The API should not include photo_url in any "completeness" logic. ### File Targets Files the agent should modify: - `src/basketball_api/routes/tryouts.py` — Add `graduating_class: int | None` to `RosterPlayer` model. Add `graduating_class=p.graduating_class` in the `api_roster()` constructor (if the field exists on the Player model). If the Player model doesn't have `graduating_class`, check for `graduation_year` or similar. - `tests/test_tryouts.py` — Add `graduating_class` to the `test_all_fields_present` expected fields set. Add a test that graduating_class is returned when populated. Files the agent should NOT touch: - The SvelteKit frontend - Database migrations (use existing model fields only) ### Acceptance Criteria - [ ] `graduating_class` appears in roster API response - [ ] Returns `null` when not set, integer when set - [ ] `test_all_fields_present` includes the new field - [ ] All existing tests still pass ### Test Expectations - [ ] Run: `pytest tests/test_tryouts.py -k "api_roster" -v` - [ ] Run: `pytest` (full suite) ### Constraints - Do NOT add database migrations — only use fields that already exist on the Player model - If `graduating_class` doesn't exist on the Player model, check for `graduation_year` or `grad_year` and map accordingly - If no graduating class field exists at all on the model, add the field to RosterPlayer as `None` and note it in the PR description ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `project-westside-basketball`
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#70
No description provided.