diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f8ad48..6ea2772 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [0.5.8] - 2026-02-17 +### Changed +- Anfragen-Zaehler zeigt nur noch Anfragen von heute (Reset um Mitternacht) +- Kommando-Badges entfernt, nur noch Kanal-Aufschluesselung angezeigt + ## [0.5.7] - 2026-02-17 ### Added - Anfragen-Aufschluesselung pro Kanal mit Kanalnamen im Dashboard diff --git a/config.yaml b/config.yaml index 06e8d32..b2c6177 100644 --- a/config.yaml +++ b/config.yaml @@ -1,4 +1,4 @@ -version: "0.5.7" +version: "0.5.8" bot: name: "MeshDD-Bot" diff --git a/meshbot/database.py b/meshbot/database.py index 778e450..c710dbd 100644 --- a/meshbot/database.py +++ b/meshbot/database.py @@ -1,6 +1,7 @@ import aiosqlite import time import logging +from datetime import datetime logger = logging.getLogger(__name__) @@ -192,14 +193,14 @@ class Database: "SELECT COUNT(*) FROM nodes WHERE last_seen >= ?", (day_ago,) ) as c: stats["nodes_24h"] = (await c.fetchone())[0] - async with self.db.execute("SELECT COUNT(*) FROM commands") as c: + today_start = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0).timestamp() + async with self.db.execute( + "SELECT COUNT(*) FROM commands WHERE timestamp >= ?", (today_start,) + ) as c: stats["total_commands"] = (await c.fetchone())[0] async with self.db.execute( - "SELECT command, COUNT(*) as cnt FROM commands GROUP BY command ORDER BY cnt DESC" - ) as cursor: - stats["command_breakdown"] = {row[0]: row[1] async for row in cursor} - async with self.db.execute( - "SELECT channel, COUNT(*) as cnt FROM commands GROUP BY channel ORDER BY cnt DESC" + "SELECT channel, COUNT(*) as cnt FROM commands WHERE timestamp >= ? GROUP BY channel ORDER BY cnt DESC", + (today_start,), ) as cursor: stats["channel_breakdown"] = {row[0]: row[1] async for row in cursor} return stats diff --git a/static/index.html b/static/index.html index fdc1a21..f465f58 100644 --- a/static/index.html +++ b/static/index.html @@ -102,17 +102,11 @@ - +