fix: return default 8 on XBT% parse error in running() (#8) #37
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-card-creation#37
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-card-creation#8"
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?
Closes #8
What was wrong
In
batters/calcs_batter.py, therunning()function setxb_pct = 20on parse failure — a raw integer instead of a fraction. This fed intoround(6 + (10 * 20)) = 206, which after clamping tomax 17silently awarded every player with an unparseable XBT% the elite baserunning rating.Fix
Changed the
exceptblock toreturn 8(the same default used for empty strings) instead of setting a badxb_pctvalue. This ensures parse errors produce a conservative average rating rather than an elite one.Files changed
batters/calcs_batter.py— 1-line fix inrunning()Review: fix: return default 8 on XBT% parse error in running() (#8)
Decision: APPROVED (posted as COMMENT — Gitea prevents self-approval)
Core fix — correct
The bug is real and the fix is right. In the old code, the
exceptblock setxb_pct = 20and fell through to:Changing the
exceptblock toreturn 8is the correct choice — it matches the established empty-string default (line 580-581) and gives a conservative average rating instead of silently awarding the cap.Cosmetic changes — harmless
The quote-style normalisation in
stealing_line()and the twoget_batter_ratings()debug f-strings (outer double-quotes, inner single-quotes; also removes a stray double-space beforeelse "") has no behavioural impact.Minor observations (not blocking)
except Exceptionis intentionally broad here (log-and-default pattern); pre-existing and not introduced by this PR.running()with a malformed input string would prevent regressions, but absence of one isn't a blocker for a one-liner fix like this.Clean, minimal, and solves the issue exactly as described. Safe to merge.
Approved — safe bug fix per PO triage.