fix: include player_name in /teams/{id}/evolutions response (#115) #119
@ -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.",
|
||||
)
|
||||
|
||||
|
||||
all_ids = ids.split(",")
|
||||
conf_message = ""
|
||||
total_cost = 0
|
||||
@ -1561,12 +1560,14 @@ async def list_team_evolutions(
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
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
|
||||
|
||||
query = (
|
||||
EvolutionCardState.select(EvolutionCardState, EvolutionTrack)
|
||||
EvolutionCardState.select(EvolutionCardState, EvolutionTrack, Player)
|
||||
.join(EvolutionTrack)
|
||||
.switch(EvolutionCardState)
|
||||
.join(Player)
|
||||
.where(EvolutionCardState.team == team_id)
|
||||
.order_by(EvolutionCardState.player_id)
|
||||
)
|
||||
@ -1581,5 +1582,9 @@ async def list_team_evolutions(
|
||||
offset = (page - 1) * 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}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user