From 144a592e5ebb6f9bd1d1893e574654e27c2306d6 Mon Sep 17 00:00:00 2001 From: anor Date: Fri, 27 Mar 2026 03:52:35 +1000 Subject: [PATCH] =?UTF-8?q?fix:=20unixepoch()=20=D0=BD=D0=B5=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6=D0=B8=D0=B2=D0=B0=D0=B5?= =?UTF-8?q?=D1=82=D1=81=D1=8F=20=D0=B2=20SQLite=20<3.38?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Заменено на time.time() - 14*86400 через параметр. Co-Authored-By: Claude Opus 4.6 (1M context) --- main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 4a84971..7252eb0 100644 --- a/main.py +++ b/main.py @@ -566,13 +566,16 @@ async def admin_stats(request: Request): from db import _conn with _conn() as conn: # Messages per day (last 14 days) + import time as _time + cutoff = _time.time() - 14 * 86400 daily = conn.execute( "SELECT date(timestamp, 'unixepoch', '+10 hours') as day, " "COUNT(*) as total, " "SUM(CASE WHEN role='user' THEN 1 ELSE 0 END) as questions, " "SUM(CASE WHEN role='assistant' THEN 1 ELSE 0 END) as answers " - "FROM messages WHERE timestamp > unixepoch() - 14*86400 " + "FROM messages WHERE timestamp > ? " "GROUP BY day ORDER BY day DESC", + (cutoff,), ).fetchall() # Totals totals = conn.execute(