From d56b3d2fff23a52a3c75a09aec28ee8c1652a7f5 Mon Sep 17 00:00:00 2001 From: anor Date: Fri, 6 Nov 2026 21:44:22 +1000 Subject: [PATCH] =?UTF-8?q?feat(=D0=B0=D0=B4=D0=BC=D0=B8=D0=BD=D0=BA=D0=B0?= =?UTF-8?q?):=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D0=B8=20=D1=81=D1=87=D1=91?= =?UTF-8?q?=D1=82=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D0=BA=D0=B0=D1=80=D1=82?= =?UTF-8?q?=D0=BE=D1=87=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/db.py b/db.py index 06b5794..0a500ad 100644 --- a/db.py +++ b/db.py @@ -966,6 +966,15 @@ def spend_by_user_since(since_ts: float) -> dict: "rub_unknown": int(r["rub_unknown"] or 0)} for r in rows} +def list_account_entries(username: str, limit: int = 200) -> list[dict]: + with _conn() as conn: + rows = conn.execute( + "SELECT id, ts, amount_kop, comment, created_by, reverses " + "FROM account_entries WHERE username = ? ORDER BY id DESC LIMIT ?", + (username.lower().strip(), max(1, min(limit, 1000)))).fetchall() + return [dict(r) for r in rows] + + def account_summary(username: str) -> dict | None: """Взносы человека одной строкой: {"entries", "deposited_kop", "first_ts"}; None — взносов не было, человек не на счёте."""