Skip to content

BaseballHelm: Scope academics eligibility reads and defaults to the active team #509

Description

@njrini99-code

Problem

getTeamAcademics loads eligibility rows by player_id only, then takes the first match per player. It also defaults missing records to is_eligible: true and academic_standing: 'good', inflating "Eligible" and understating "At Risk" summary cards.

Evidence

  • src/app/baseball/actions/academics.ts (lines 145-148): query .in('player_id', playerIds) with no team_id filter
  • src/app/baseball/actions/academics.ts (line 181): uses eligibilityRecords.find(e => e.player_id === m.player_id)
  • src/app/baseball/actions/academics.ts (lines 193-194): default is_eligible: eligibility?.is_eligible ?? true and academic_standing: eligibility?.academic_standing ?? 'good'

Why it matters

Coaches can see wrong GPA/eligibility for transfers or multi-semester history, and roster-wide eligibility metrics lie when no record exists.

Acceptance criteria

  • Team academics reads filter eligibility by team_id (and prefer the latest semester for that team).
  • Players with no eligibility row show unknown/ineligible-safe UI defaults, not "Eligible / Good Standing".
  • Summary cards recompute from the scoped data only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    baseballBaseballHelmbugIncorrect behavior or regression

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions