Sheet: large portrait slot, writable notes in summary and lobby

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HJhXuLD2Z6hv3Wqeq9UL9K
This commit is contained in:
Claude
2026-10-24 18:10:12 +00:00
parent 7940fcfa3f
commit a2103566a0
8 changed files with 83 additions and 25 deletions
+2 -2
View File
@@ -99,7 +99,7 @@ def to_docx(ch: dict, rules: dict) -> bytes:
p = doc.add_paragraph()
p.add_run("Other: ").bold = True
p.add_run(s["other"])
for key, head in (("background", "Background"), ("notes", "Notes")):
for key, head in (("background", "Background"), ("conditions", "Conditions"), ("notes", "Notes")):
if ch.get(key):
doc.add_heading(head, 1)
doc.add_paragraph(ch[key])
@@ -171,7 +171,7 @@ def to_pdf(ch: dict, rules: dict) -> bytes:
el.append(Paragraph("-", body))
if s["other"]:
el.append(Paragraph(f"<b>Other:</b> {esc(s['other'])}", body))
for key, head in (("background", "Background"), ("notes", "Notes")):
for key, head in (("background", "Background"), ("conditions", "Conditions"), ("notes", "Notes")):
if ch.get(key):
el += [Paragraph(head, h2), Paragraph(esc(ch[key]), body)]
+16
View File
@@ -494,6 +494,22 @@ def update_character(cid: str, ch: dict = Body(...), user: dict = Depends(curren
return {"ok": True}
@api.put("/characters/{cid}/notes")
def update_notes(cid: str, body: dict = Body(...), user: dict = Depends(current_user)):
"""Only the two note fields, so typing in the lobby never overwrites other changes made elsewhere."""
with db() as con:
_owned(con, "characters", cid, user)
ch = json.loads(con.execute("SELECT data FROM characters WHERE id=?", (cid,)).fetchone()["data"])
for k in ("notes", "conditions"):
if k in body:
ch[k] = str(body[k] or "")[:5000]
con.execute("UPDATE characters SET data=?, updated=? WHERE id=?", (json.dumps(ch), time.time(), cid))
lobbies = [r["lobby_id"] for r in con.execute("SELECT lobby_id FROM lobby_members WHERE character_id=?", (cid,))]
for lid in lobbies:
hub.notify(lid, "sheet", cid=cid)
return {"ok": True}
@api.delete("/characters/{cid}")
def delete_character(cid: str, user: dict = Depends(current_user)):
with db() as con: