From 085ade75bf85f562bf8bb522710a3552914facd4 Mon Sep 17 00:00:00 2001 From: Andrew Simonson Date: Fri, 13 Feb 2026 12:25:21 -0600 Subject: [PATCH] backmerge --- src/monitor.py | 10 ++++++++-- src/templates/header.html | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/monitor.py b/src/monitor.py index 3f0cf2b..9f25c88 100644 --- a/src/monitor.py +++ b/src/monitor.py @@ -277,8 +277,14 @@ class ServiceMonitor: if total_count == 0: return None - if total_count < 3: - return None + # Only show uptime for a window if we have data older than it + if hours: + cur.execute( + 'SELECT EXISTS(SELECT 1 FROM service_checks WHERE service_id = %s AND timestamp <= %s)', + (service_id, cutoff), + ) + if not cur.fetchone()[0]: + return None return round((online_count / total_count) * 100, 2) finally: diff --git a/src/templates/header.html b/src/templates/header.html index 20b4b1b..9af7f1a 100755 --- a/src/templates/header.html +++ b/src/templates/header.html @@ -53,7 +53,7 @@ - + {# #} {{ var['title'] }}