feat: add get_away_team and get_home_team methods to StratGame (#21) #67
No reviewers
Labels
No Label
ai-changes-requested
ai-failed
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
ai-working
bug
enhancement
feature
in-queue
performance
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-discord#67
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-discord-21"
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
get_away_team()andget_home_team()async methods to theStratGamedataclassget_game_team()function, which already handles the SBA vs PD distinction# TODOcomment from theGameORM class that requested these methodsWhat was fixed
Callers that needed to look up a team from a
StratGamehad to repeat the inline logic (checkinggame.is_pd, callingget_pd_teamvsget_sba_team). These methods centralize that pattern on the dataclass itself.Usage
Files changed
db_calls_gameplay.py— Added two methods toStratGame; removed the TODO comment fromGameOther observations
'→") throughout the file, consistent with all prior PRs in this repo. Functional diff is the two new methods + TODO removal only.🤖 Generated with Claude Code
AI Code Review
Files Reviewed
db_calls_gameplay.py(modified)Findings
Correctness
StratGamehasaway_team_id: intandhome_team_id: intas required fields — both methods reference them correctly.get_game_teamsignature is(game: StratGame, gm_id=None, team_abbrev=None, team_id=None, skip_cache=False) -> dict. The new methods call it asget_game_team(self, team_id=self.away/home_team_id, skip_cache=skip_cache)— fully correct.get_game_teamis defined afterStratGamein the file (~line 291 vs ~line 193). This is a forward reference in a method body, which Python resolves at call time (not class definition time). No issue.asyncsinceget_game_teamisasync.-> dictmatchesget_game_team's return type. ✓skip_cacheis correctly passed through. ✓Gameis correct — the requested functionality is now implemented. Placement onStratGame(the runtime dataclass) rather thanGame(the Peewee ORM model) is actually the right call, since callers work withStratGameinstances.Security
Style & Conventions
get_game_teamabstraction correctly.'→") throughout the file is cosmetic only, consistent with PRs #58–#66.Suggestions
get_away_team/get_home_teamagainst a mockget_game_teamwould be nice, but not required for a one-line delegation wrapper.Verdict: APPROVED
Clean, correct implementation. The delegation to
get_game_teamcentralizes SBA/PD team-lookup logic as intended. No edge cases, no security concerns, follows project conventions.Automated review by Claude PR Reviewer
1d79657fa1to109b88b9e5Closing — will re-implement fresh against
main. Original PR had unrebaseable conflicts from the scouting refactor.Pull request closed