fix(жалобы): похвала, миграция и разбор
This commit is contained in:
@@ -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]:
|
||||
|
||||
Reference in New Issue
Block a user