fix: use player_id instead of key_bbref in create_pit_position() (#7) #38
No reviewers
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-card-creation#38
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-card-creation#7"
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 #7
Summary
create_pit_position()fallback branch:int(df_data["key_bbref"])always raisesValueErrorfor string IDs like'verlaju01'int(float(df_data["player_id"]))to match the pattern used in thecreate_pitching_card()function in the same fileFiles Changed
pitchers/creation.py— line 358:player_idfield in fallbackpit_positionsentryTest Results
No test suite exists in this repo (as confirmed in CLAUDE.md). Fix verified by reading the changed code.
Other observations
The development environment's linter automatically reformatted several f-strings in the same file (single-quoted outer strings → double-quoted, inner dict keys swapped). These are semantically identical and part of the committed diff, but are auto-formatter changes, not manual edits.
AI Code Review
Files Reviewed
pitchers/creation.py(modified)Findings
Correctness
int(df_data["key_bbref"])in the fallback branch ofcreate_pit_position()always raisesValueErrorfor string Baseball Reference IDs (e.g.'verlaju01'). The replacementint(float(df_data["player_id"]))correctly uses the database player ID, consistent with theifbranch at line 339 andcreate_pitching_card()at line 279.create_position()runs,player_idis guaranteed to be populated for all pitchers —create_new_players()fills it in for new players andcalculate_pitching_cards()merges card IDs — so thefloat()conversion is defensive but safe.P, 1 inning, range 5, error 51), and only log an error ifplayer_iditself is somehow missing.Security
Style & Conventions
ifbranch at line 339 usesint(df_data["player_id"])without afloat()intermediate, while the fixedelsebranch now usesint(float(df_data["player_id"])). Both are correct; thefloat()is a defensive pattern used elsewhere in the file and is not a concern.Suggestions
Verdict: APPROVED ✓
Clean one-line fix that directly addresses the root cause documented in issue #7. Matches the established pattern in the codebase and does not introduce any regressions. Note: Gitea prevented a formal APPROVED state because the PR author and reviewer share the same account — this COMMENT represents an approval.
Automated review by Claude PR Reviewer