Fix: Geburtstag aller Hunde + Kotbeutel-Stationen in Stats (SW by-v962)

- worlds.js: bdayDog = _dogs.find(...) — Geburtstag gilt für alle Hunde, nicht nur den aktiven
- Banner, KI-Call, "Was hat sich X gewünscht?" nutzen bdayDog.name
- stats.py: kotbeutel-Count aus user_map_pois WHERE type='kotbeutel'
- landing: Stats-Band 5. Kachel "Kotbeutel-Stationen"
This commit is contained in:
rene 2026-05-14 22:00:52 +02:00
parent ebff9d820d
commit 07db68aea2
6 changed files with 28 additions and 18 deletions

View file

@ -30,19 +30,23 @@ async def public_stats():
if _pub_cache["data"] and now - _pub_cache["ts"] < _PUB_TTL:
return _pub_cache["data"]
with db() as conn:
users = conn.execute("SELECT COUNT(*) FROM users").fetchone()[0]
dogs = conn.execute("SELECT COUNT(*) FROM dogs").fetchone()[0]
km = conn.execute(
users = conn.execute("SELECT COUNT(*) FROM users").fetchone()[0]
dogs = conn.execute("SELECT COUNT(*) FROM dogs").fetchone()[0]
km = conn.execute(
"SELECT ROUND(COALESCE(SUM(distanz_km),0),0) FROM routes"
).fetchone()[0]
posts = conn.execute("SELECT COUNT(*) FROM forum_posts").fetchone()[0]
diary = conn.execute("SELECT COUNT(*) FROM diary").fetchone()[0]
posts = conn.execute("SELECT COUNT(*) FROM forum_posts").fetchone()[0]
diary = conn.execute("SELECT COUNT(*) FROM diary").fetchone()[0]
kotbeutel = conn.execute(
"SELECT COUNT(*) FROM user_map_pois WHERE type='kotbeutel'"
).fetchone()[0]
data = {
"users": users,
"dogs": dogs,
"km": int(km or 0),
"forum_posts": posts,
"diary_entries": diary,
"kotbeutel": kotbeutel,
}
_pub_cache["data"] = data
_pub_cache["ts"] = now