fix: correct column references in season pitching stats SQL #105
No reviewers
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-database#105
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/pitching-stats-column-name"
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
rbipercentcalculation in the season pitching stats view referencedsp.on_first,sp.on_second,sp.on_third— these columns don't existsp.on_first_id,sp.on_second_id,sp.on_third_idFailed to update season pitching stats after gameerrors for every game result submissionTest plan
🤖 Generated with Claude Code
AI Code Review
Files Reviewed
app/dependencies.py(modified)Findings
Correctness
The fix is correct. The SQL query in
update_season_pitching_stats()was referencingsp.on_first,sp.on_second, andsp.on_third— columns that do not exist in thestratplaytable. The actual column names, confirmed inapp/routers_v3/stratplay/models.pylines 26–31, areon_first_id,on_second_id, andon_third_id. All six occurrences of the wrong names (three in theWHENclause, three in theTHENdivisor) are corrected.The surrounding context is also consistent: the adjacent
lob_2outscalculation in the same SQL block correctly useson_first_final/on_second_final/on_third_final, and the ORM layer inbatting.pyalso distinguishes between the_idcolumns and the_finalcolumns — confirming the naming convention is deliberate and the fix aligns with the rest of the codebase.Security
No issues found.
Style & Conventions
No issues found. The fix is a pure column name correction with no structural changes; the formatting and SQL style are unchanged.
Suggestions
batting.pyreferences bareStratPlay.on_first,StratPlay.on_second, andStratPlay.on_thirdvia the Peewee ORM (e.g. lines 111–118, 280–287). These appear to be ORM field accessors; whether they map correctly to the underlying_idFK columns depends on how the Peewee model is declared. If those are stale names they would fail at query time — worth a follow-up check, but it is pre-existing code outside the scope of this PR.Verdict: APPROVED (posted as COMMENT — Gitea blocks self-review approval)
Targeted, correct fix for a clear column naming bug. The wrong names produced a SQL error on every game result write, and the corrected names match both the Pydantic model definition and the database schema. Safe to merge.
Automated review by Claude PR Reviewer