Fix System Health.

This commit is contained in:
2025-07-13 13:52:13 +02:00
parent cc0b3413cc
commit 5763a9cfc4

View File

@@ -456,13 +456,18 @@ def system_admin_health():
func.date(SystemEvent.timestamp) == today
).count()
# Calculate 24-hour error count
# Calculate 24-hour error and warning counts
yesterday = now - timedelta(days=1)
error_count_24h = SystemEvent.query.filter(
SystemEvent.timestamp >= yesterday,
SystemEvent.severity == 'error'
).count()
warning_count_24h = SystemEvent.query.filter(
SystemEvent.timestamp >= yesterday,
SystemEvent.severity == 'warning'
).count()
# Log the health check
SystemEvent.log_event(
'system_health_check',
@@ -484,7 +489,8 @@ def system_admin_health():
db_error=db_error,
uptime_duration=uptime_duration,
today_events=today_events,
error_count_24h=error_count_24h)
error_count_24h=error_count_24h,
warning_count_24h=warning_count_24h)
@system_admin_bp.route('/branding', methods=['GET', 'POST'])