Add the my-decisions overview store queries and controller (INFD-WP-0003 T01, T02)

Store.memos_for / dispositions_by list the signed-in person's memos and
their own dispositions. ReviewController.overview classifies each row
after its own fresh PDP read and a live get-by-id engine status; refused
rows keep only the memo id, and no presentation is created.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 359683@bnt-lap001
Assistant-Session: eebdc939-7a9b-4e50-9d39-c8437e8a14ec
This commit is contained in:
tegwick 2026-09-21 22:02:21 +02:00
parent 1e94835c07
commit f0a9bb1d4c
5 changed files with 208 additions and 3 deletions

View file

@ -386,6 +386,28 @@ class Store:
return [disposition_from(json.loads(r[0])) for r in db.execute(
"SELECT body FROM dispositions WHERE presentation_id=? ORDER BY rowid", (presentation_id,))]
def memos_for(self, subject):
"""Latest version of every held memo naming ``subject`` as the person bound."""
with self._connection() as db:
rows = db.execute("SELECT m.body FROM memos m WHERE m.version="
"(SELECT MAX(version) FROM memos WHERE id=m.id) ORDER BY m.id").fetchall()
memos = (memo_from(json.loads(r[0])) for r in rows)
return [m for m in memos if m.binding.principal.id == subject and m.binding.principal.kind == "person"]
def dispositions_by(self, subject, memo_id):
"""``subject``'s dispositions on every version of a memo, oldest first, with any submission."""
with self._connection() as db:
rows = db.execute("SELECT d.body,s.state,s.approved_at FROM dispositions d "
"JOIN presentations p ON p.id=d.presentation_id "
"LEFT JOIN submissions s ON s.disposition_id=d.id "
"WHERE p.memo_id=? ORDER BY d.rowid", (memo_id,)).fetchall()
result = []
for row in rows:
d = disposition_from(json.loads(row["body"]))
if d.actor.sub == subject:
result.append((d, {"state": row["state"], "approved_at": row["approved_at"]} if row["state"] else None))
return result
def presentation_content(self, presentation_id):
with self._connection() as db:
row = db.execute("SELECT content FROM evidence WHERE class=? AND "