Batch BattingCard/BattingCardRatings lookups in lineup endpoints #18
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#18
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
`app/routers_v2/teams.py` — `get_bratings` helper (line 373) and `get_scouting_dfs` each call `get_or_none` for every individual player during lineup construction.
Priority: medium
Fixed in PR #45.
Replaced the per-player
get_or_none()calls insideget_bratings()with two bulk SELECT queries executed once before the position loop — one forBattingCard, one forBattingCardRatings. Both are stored in dicts keyed by player_id / card+hand, reducing DB round trips from O(3N) to O(2) per lineup build.