Fix heatmap button args

This commit is contained in:
2026-02-15 00:51:09 +03:00
parent b138ee316d
commit 568cd86844

View File

@@ -13,8 +13,7 @@ from keyboards import (
system_logs_integrations_kb, system_logs_integrations_kb,
system_logs_kb, system_logs_kb,
openwrt_kb, openwrt_kb,
docker_kb, docker_kb, backup_kb,
backup_kb,
) )
from system_checks import security, disks, hardware, list_disks, smart_last_test from system_checks import security, disks, hardware, list_disks, smart_last_test
from services.http_checks import get_url_checks, check_url from services.http_checks import get_url_checks, check_url
@@ -490,14 +489,15 @@ async def incidents_diff(msg: Message):
async def alerts_heatmap(msg: Message): async def alerts_heatmap(msg: Message):
if not is_admin_msg(msg): if not is_admin_msg(msg):
return return
parts = msg.text.split()
hours = 48 hours = 48
category = None category = None
for part in parts[1:]: if msg.text.startswith("/alerts_heatmap"):
if part.isdigit(): parts = msg.text.split()
hours = max(1, int(part)) for part in parts[1:]:
else: if part.isdigit():
category = part.lower() hours = max(1, int(part))
else:
category = part.lower()
rows = read_raw(cfg, hours=hours, limit=8000, include_old=True) rows = read_raw(cfg, hours=hours, limit=8000, include_old=True)
buckets: dict[datetime, int] = {} buckets: dict[datetime, int] = {}
for dt, line in rows: for dt, line in rows: