Feature: ORS-Stats im Admin-Panel — Tagesverbrauch/2000, 30-Tage-Sparkline, Top-Nutzer — SW by-v485, APP_VER 462

This commit is contained in:
rene 2026-04-29 10:10:59 +02:00
parent 69140a261e
commit 392359df45
6 changed files with 170 additions and 3 deletions

View file

@ -283,6 +283,14 @@ async def suggest_route(data: SuggestRequest, user=Depends(get_current_user)):
""", (user["id"], week_start))
current_count += 1
# Täglichen Gesamtzähler hochzählen (für Admin-Stats)
today_str = _dt.date.today().isoformat()
with db() as conn:
conn.execute("""
INSERT INTO ors_daily_total (date, count) VALUES (?, 1)
ON CONFLICT(date) DO UPDATE SET count = count + 1
""", (today_str,))
weekly_remaining = None if is_privileged else max(0, WEEKLY_LIMIT - current_count)
return {