fix: use max() for pitcher OPS split weighting (#6) #60
No reviewers
Labels
No Label
ai-changes-requested
ai-failed
ai-merged
ai-pr-opened
ai-reviewed
ai-reviewing
ai-reviewing
ai-working
bug
enhancement
evolution
performance
phase-0
phase-1a
phase-1b
phase-1c
phase-1d
security
tech-debt
todo
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-database#60
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-database#6"
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
Resolves #6.
The
get_total_opsformula(ops_vr + ops_vl + min(ops_vl, ops_vr)) / 3weighted the better platoon split (lower OPS allowed), effectively hiding platoon weaknesses. Since starting pitchers face both LHH and RHH in a game, the correct behaviour is to penalise the weaker split (higher OPS allowed).Changed
min→maxin both locations:get_total_ops(previously line 620, now line 621) — used bysort_bullpensort_startersinnerget_total_ops(previously line 701, now line 703)Replaced the
# TODO: should this be max??comment with a brief explanatory note.Files changed
app/routers_v2/teams.pyTest results
No test suite in this repo. Both changed lines verified by reading back the file.
AI Code Review
Files Reviewed
app/routers_v2/teams.py(modified)Findings
Correctness
(ops_vr + ops_vl + min(ops_vl, ops_vr)) / 3gave extra weight to the pitcher's better platoon split, underweighting vulnerabilities. The new formula(ops_vr + ops_vl + max(ops_vl, ops_vr)) / 3penalises the weaker split — appropriate since starters face both handedness in a game.sort_pitchersouter scope andsort_startersinner scope) are updated consistently.vlval is None or vrval is Noneguard returningfloat("inf")is unchanged and correct.ops_vl == ops_vr:max()andmin()return identical values, so no behavioural difference — safe.Minor inaccuracy in the PR description: the outer
get_total_opsis described as "used bysort_bullpen" but the enclosing function issort_pitchers. Doesn't affect correctness.Security
Style & Conventions
Suggestions (non-blocking)
min(). Could be cleaned up in a follow-up, but out of scope here.get_total_opsis defined twice — once insidesort_pitchersand once insidesort_starters. Pre-existing duplication, out of scope, but a candidate for future refactor.Verdict: APPROVED
Minimal, focused, and correct. The
min→maxchange is well-reasoned and both locations updated consistently. No scope creep, no security concerns.Automated review by Claude PR Reviewer (posted as comment — Gitea self-review restriction applies)