Merge pull request 'fix: consolidate redundant double-query in get_one_play (#14)' (#52) from ai/paper-dynasty-database#14 into next-release
Reviewed-on: #52
This commit is contained in:
commit
8283425b84
@ -1390,10 +1390,10 @@ async def get_game_summary(
|
|||||||
|
|
||||||
@router.get("/{play_id}")
|
@router.get("/{play_id}")
|
||||||
async def get_one_play(play_id: int):
|
async def get_one_play(play_id: int):
|
||||||
if StratPlay.get_or_none(StratPlay.id == play_id) is None:
|
play = StratPlay.get_or_none(StratPlay.id == play_id)
|
||||||
|
if play is None:
|
||||||
raise HTTPException(status_code=404, detail=f"Play ID {play_id} not found")
|
raise HTTPException(status_code=404, detail=f"Play ID {play_id} not found")
|
||||||
r_play = model_to_dict(StratPlay.get_by_id(play_id))
|
return model_to_dict(play)
|
||||||
return r_play
|
|
||||||
|
|
||||||
|
|
||||||
@router.patch("/{play_id}")
|
@router.patch("/{play_id}")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user