fix: dedupe player-edit route + strip embedding blob from JSON
Follow-up to the /players build:
- the new POST /player/{id} collided with the existing PATCH route (F811); fold
the name→named-flip into the existing PATCH and point the UI at it.
- villain_recall / update_player returned the raw row including
descriptor_embedding (bytes) → PydanticSerializationError on the API. Strip it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -1073,7 +1073,11 @@ def update_player(player_id: int, **fields) -> dict | None:
|
||||
conn.execute(f"UPDATE poker_players SET {', '.join(sets)} WHERE id = ?",
|
||||
(*vals, player_id))
|
||||
row = _c().execute("SELECT * FROM poker_players WHERE id = ?", (player_id,)).fetchone()
|
||||
return dict(row) if row else None
|
||||
if not row:
|
||||
return None
|
||||
d = dict(row)
|
||||
d.pop("descriptor_embedding", None) # raw bytes — not JSON-serializable
|
||||
return d
|
||||
|
||||
|
||||
# --- villain identity resolution (nameless villains; see docs/SCOUTING_DESK.md) ---
|
||||
@@ -1544,6 +1548,7 @@ def villain_recall(player_id: int) -> dict | None:
|
||||
if not p:
|
||||
return None
|
||||
p = dict(p)
|
||||
p.pop("descriptor_embedding", None) # raw bytes — not JSON-serializable, not needed
|
||||
obs = [dict(r) for r in _c().execute(
|
||||
"SELECT o.*, s.venue AS s_venue, s.started_at AS s_at FROM player_observations o "
|
||||
"LEFT JOIN poker_sessions s ON s.id = o.session_id WHERE o.player_id = ? "
|
||||
|
||||
Reference in New Issue
Block a user