Merge pull request 'fix: include player_name in /teams/{id}/evolutions response (#115)' (#119) from ai/paper-dynasty-database#115 into next-release
Some checks are pending
Build Docker Image / build (push) Waiting to run
Some checks are pending
Build Docker Image / build (push) Waiting to run
Reviewed-on: #119 Reviewed-by: cal <cal@manticorum.com>
This commit is contained in:
commit
57d8a929fd
@ -1049,7 +1049,6 @@ async def team_buy_players(team_id: int, ids: str, ts: str):
|
|||||||
detail=f"You are not authorized to buy {this_team.abbrev} cards. This event has been logged.",
|
detail=f"You are not authorized to buy {this_team.abbrev} cards. This event has been logged.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
all_ids = ids.split(",")
|
all_ids = ids.split(",")
|
||||||
conf_message = ""
|
conf_message = ""
|
||||||
total_cost = 0
|
total_cost = 0
|
||||||
@ -1561,12 +1560,14 @@ async def list_team_evolutions(
|
|||||||
logging.warning("Bad Token: [REDACTED]")
|
logging.warning("Bad Token: [REDACTED]")
|
||||||
raise HTTPException(status_code=401, detail="Unauthorized")
|
raise HTTPException(status_code=401, detail="Unauthorized")
|
||||||
|
|
||||||
from ..db_engine import EvolutionCardState, EvolutionTrack
|
from ..db_engine import EvolutionCardState, EvolutionTrack, Player
|
||||||
from ..routers_v2.evolution import _build_card_state_response
|
from ..routers_v2.evolution import _build_card_state_response
|
||||||
|
|
||||||
query = (
|
query = (
|
||||||
EvolutionCardState.select(EvolutionCardState, EvolutionTrack)
|
EvolutionCardState.select(EvolutionCardState, EvolutionTrack, Player)
|
||||||
.join(EvolutionTrack)
|
.join(EvolutionTrack)
|
||||||
|
.switch(EvolutionCardState)
|
||||||
|
.join(Player)
|
||||||
.where(EvolutionCardState.team == team_id)
|
.where(EvolutionCardState.team == team_id)
|
||||||
.order_by(EvolutionCardState.player_id)
|
.order_by(EvolutionCardState.player_id)
|
||||||
)
|
)
|
||||||
@ -1581,5 +1582,9 @@ async def list_team_evolutions(
|
|||||||
offset = (page - 1) * per_page
|
offset = (page - 1) * per_page
|
||||||
page_query = query.offset(offset).limit(per_page)
|
page_query = query.offset(offset).limit(per_page)
|
||||||
|
|
||||||
items = [_build_card_state_response(state) for state in page_query]
|
items = []
|
||||||
|
for state in page_query:
|
||||||
|
item = _build_card_state_response(state)
|
||||||
|
item["player_name"] = state.player.p_name
|
||||||
|
items.append(item)
|
||||||
return {"count": total, "items": items}
|
return {"count": total, "items": items}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user