From cc0b3413ccc2e241b647840e0d0479bae061b2e3 Mon Sep 17 00:00:00 2001 From: Jens Luedicke Date: Sun, 13 Jul 2025 13:46:18 +0200 Subject: [PATCH] Fix System Health. --- routes/system_admin.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/routes/system_admin.py b/routes/system_admin.py index b37d27c..68e9803 100644 --- a/routes/system_admin.py +++ b/routes/system_admin.py @@ -455,6 +455,13 @@ def system_admin_health(): today_events = SystemEvent.query.filter( func.date(SystemEvent.timestamp) == today ).count() + + # Calculate 24-hour error count + yesterday = now - timedelta(days=1) + error_count_24h = SystemEvent.query.filter( + SystemEvent.timestamp >= yesterday, + SystemEvent.severity == 'error' + ).count() # Log the health check SystemEvent.log_event( @@ -476,7 +483,8 @@ def system_admin_health(): db_healthy=db_healthy, db_error=db_error, uptime_duration=uptime_duration, - today_events=today_events) + today_events=today_events, + error_count_24h=error_count_24h) @system_admin_bp.route('/branding', methods=['GET', 'POST'])