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 @@ - +
-
-
- Anfragen: - -
-
- Kanaele: - -
+
+ Anfragen/Kanal: +
diff --git a/static/js/dashboard.js b/static/js/dashboard.js index a0fc42d..7406f19 100644 --- a/static/js/dashboard.js +++ b/static/js/dashboard.js @@ -166,16 +166,6 @@ function updateStats(stats) { document.getElementById('statNodes24h').textContent = stats.nodes_24h || 0; document.getElementById('statCommands').textContent = stats.total_commands || 0; - const breakdown = document.getElementById('commandBreakdown'); - const cmds = stats.command_breakdown || {}; - if (Object.keys(cmds).length > 0) { - breakdown.innerHTML = Object.entries(cmds).map(([cmd, count]) => - `${escapeHtml(cmd)} ${count}` - ).join(''); - } else { - breakdown.innerHTML = 'Noch keine Anfragen'; - } - const chBreakdown = document.getElementById('channelBreakdown'); const chCounts = stats.channel_breakdown || {}; if (Object.keys(chCounts).length > 0) {