Skip to content

BaseballHelm: Compute OBP/SLG/OPS in legacy aggregate recalculation #436

Description

@njrini99-code

Problem

recalculatePlayerAggregates only persists career_avg (plus practice/game avgs), but My Stats StatsOverviewCards reads career_obp, career_slg, and career_ops — fields that are never written.

Evidence

  • src/app/baseball/actions/stats.ts (lines 515-531): upserts career_avg, practice_avg, game_avg only
  • src/components/baseball/player-stats/StatsOverviewCards.tsx (lines 85-88): displays aggregates.career_obp/slg/ops

Why it matters

Players with CSV/practice upload data see AVG populated but OBP/SLG/OPS permanently show "---" in the overview cards, despite sufficient counting stats in baseball_player_stats.

Acceptance criteria

  • recalculatePlayerAggregates derives and stores career_obp, career_slg, career_ops from summed counting stats (standard formulas, null on zero denominators).
  • My Stats overview cards show the computed slash line after upload.
  • Unit test covers a multi-session aggregate with walks/SF/HBP.

Metadata

Metadata

Assignees

No one assigned

    Labels

    baseballBaseballHelmbugIncorrect behavior or regressionstatsStat calculations or analytics

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions