feat: edit hands from the viewer + "not my hand" disown

Addresses "no way to edit hands" and cleaning up misattributed ones:
- hand viewer (/hand/{id}) gets an "✎ Edit this hand" panel: position, cards,
  board, your net, tag, lesson → Save (existing PATCH), plus Delete.
- "Not my hand" → POST /hand/{id}/disown → poker.disown_hand clears the flat hero
  fields and rewrites structured with hero_involved=false, so a hand mislabeled as
  Brian's becomes a clean observed hand (replay stops showing him as hero).

1 test. Full suite 156 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-04 03:00:21 +00:00
parent 2be43848a7
commit 4ce1b05fad
4 changed files with 91 additions and 0 deletions
+7
View File
@@ -192,6 +192,13 @@ def create_app() -> FastAPI:
logbus.log("info", "hand edited", id=hand_id, fields=list(body))
return {"ok": h is not None, "hand": h}
@app.post("/hand/{hand_id}/disown")
async def hand_disown(hand_id: int) -> dict:
"""Reclassify a hand as observed (not Brian's) — fix a misattributed one."""
h = await asyncio.to_thread(poker.disown_hand, hand_id)
logbus.log("info", "hand disowned", id=hand_id)
return {"ok": h is not None, "hand": h}
@app.delete("/hand/{hand_id}")
async def hand_delete(hand_id: int) -> dict:
"""Delete a logged hand."""