Compare commits

..

5 Commits

Author SHA1 Message Date
Cal Corum
ae8c20ea1c fix: batch-fetch PitchingCardRatings instead of per-row queries (#19)
Replace two get_or_none calls per row in sort_pitchers and sort_starters
with a single batched SELECT for all card IDs, reducing N*2 queries to 1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 03:19:43 +00:00
cal
9096a4b976 Merge pull request 'fix: add type annotations to untyped path parameters (#27)' (#43) from ai/paper-dynasty-database#27 into next-release
Reviewed-on: #43
2026-03-05 03:18:49 +00:00
Cal Corum
5f86c8cb20 fix: add type annotations to untyped path parameters (#27)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 03:18:38 +00:00
cal
20f727a119 Merge pull request 'fix: remove duplicate ranking_max filter in get_teams (#21)' (#42) from ai/paper-dynasty-database#21 into next-release
Reviewed-on: #42
2026-03-05 03:17:50 +00:00
Cal Corum
86b4338b66 fix: remove duplicate ranking_max filter in get_teams (#21)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 16:01:52 -06:00
3 changed files with 4 additions and 7 deletions

View File

@ -109,7 +109,7 @@ async def get_packs(
@router.get('/{pack_id}')
async def get_one_pack(pack_id, csv: Optional[bool] = False):
async def get_one_pack(pack_id: int, csv: Optional[bool] = False):
try:
this_pack = Pack.get_by_id(pack_id)
except Exception:

View File

@ -587,7 +587,7 @@ async def search_players(
@router.get("/{player_id}")
async def get_one_player(player_id, csv: Optional[bool] = False):
async def get_one_player(player_id: int, csv: Optional[bool] = False):
try:
this_player = Player.get_by_id(player_id)
except Exception:
@ -1119,7 +1119,7 @@ async def post_image_reset(
@router.delete("/{player_id}")
async def delete_player(player_id, token: str = Depends(oauth2_scheme)):
async def delete_player(player_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logging.warning(f"Bad Token: {token}")
raise HTTPException(

View File

@ -138,9 +138,6 @@ async def get_teams(
if ranking_max is not None:
all_teams = all_teams.where(Team.ranking <= ranking_max)
if ranking_max is not None:
all_teams = all_teams.where(Team.ranking <= ranking_max)
if has_guide is not None:
# Use boolean comparison (PostgreSQL-compatible)
if not has_guide:
@ -176,7 +173,7 @@ async def get_teams(
@router.get("/{team_id}")
async def get_one_team(team_id, inc_packs: bool = True, csv: Optional[bool] = False):
async def get_one_team(team_id: int, inc_packs: bool = True, csv: Optional[bool] = False):
try:
this_team = Team.get_by_id(team_id)
except Exception: