diff --git a/apps/web/src/views/detail.ejs b/apps/web/src/views/detail.ejs
index f29bdbd..f2f09d4 100644
--- a/apps/web/src/views/detail.ejs
+++ b/apps/web/src/views/detail.ejs
@@ -224,7 +224,7 @@
// Seed running stats for SSE incremental updates
_totalPings = results.length;
_upPings = upPings.length;
- _latencies = latencies.slice(-100);
+ _latencies = results.filter(r => r.latency_ms != null).slice(-100).map(r => ({ ms: r.latency_ms, up: r.up }));
document.getElementById('stat-status').innerHTML = lastPing
? (lastPing.up ? 'Up' : 'Down')
@@ -361,7 +361,7 @@
// No interval poll — SSE handles all live updates
// Track running stats in memory for incremental updates
- let _totalPings = 0, _upPings = 0, _latencies = [];
+ let _totalPings = 0, _upPings = 0, _latencies = []; // _latencies: [{ms, up}]
// SSE: live ping updates
const id = window.location.pathname.split('/').pop();
@@ -370,9 +370,9 @@
_totalPings++;
if (ping.up) _upPings++;
if (ping.latency_ms != null) {
- _latencies.push(ping.latency_ms);
+ _latencies.push({ ms: ping.latency_ms, up: ping.up });
if (_latencies.length > 100) _latencies.shift();
- const avg = Math.round(_latencies.reduce((a,b)=>a+b,0) / _latencies.length);
+ const avg = Math.round(_latencies.reduce((a,b)=>a+b.ms,0) / _latencies.length);
document.getElementById('stat-latency').textContent = avg + 'ms';
}
@@ -398,9 +398,7 @@
// ── Latency chart ─────────────────────────────────────────────
if (ping.latency_ms != null) {
- renderLatencyChart([...(_latencies.map((ms, i) => ({
- latency_ms: ms, checked_at: new Date(Date.now() - (_latencies.length - i) * 10000).toISOString()
- })))]);
+ renderLatencyChart(_latencies.map(e => ({ latency_ms: e.ms, up: e.up, checked_at: '' })));
}
// ── Ping table ───────────────────────────────────────────────