fix(жалобы): похвала, миграция и разбор

This commit is contained in:
anor
2026-11-06 22:52:14 +10:00
parent 4f3d47926a
commit 520b7c5a10
6 changed files with 83 additions and 9 deletions
+11 -1
View File
@@ -138,7 +138,17 @@ def save_feedback(username: str, tab_id: str, comment: str, answer: str,
def count_feedback_new() -> int:
with _conn() as conn:
return int(conn.execute("SELECT COUNT(*) AS n FROM feedback WHERE status = 'new'").fetchone()["n"])
return int(conn.execute(
"SELECT COUNT(*) AS n FROM feedback WHERE status = 'new' "
"AND (category IS NULL OR category != 'praise')").fetchone()["n"])
def set_feedback_status(feedback_id: int, status: str) -> bool:
if status not in ("new", "resolved", "deferred", "ignored"):
raise ValueError("неизвестный статус жалобы")
with _conn() as conn:
return conn.execute("UPDATE feedback SET status = ? WHERE id = ?",
(status, feedback_id)).rowcount > 0
def get_feedback(limit: int = 200) -> list[dict]: