fix: avgLatency NaN — extract .latency_ms from ping objects
This commit is contained in:
@@ -25,7 +25,8 @@
|
|||||||
<% } else { %>
|
<% } else { %>
|
||||||
<% it.monitors.forEach(function(m) {
|
<% it.monitors.forEach(function(m) {
|
||||||
const latencies = (m.pings || []).filter(p => p.latency_ms != null);
|
const latencies = (m.pings || []).filter(p => p.latency_ms != null);
|
||||||
const avgLatency = latencies.length ? Math.round(latencies.reduce((a, b) => a + b, 0) / latencies.length) : null;
|
const latencyVals = latencies.map(p => p.latency_ms);
|
||||||
|
const avgLatency = latencyVals.length ? Math.round(latencyVals.reduce((a, b) => a + b, 0) / latencyVals.length) : null;
|
||||||
%>
|
%>
|
||||||
<a href="/dashboard/monitors/<%= m.id %>" data-monitor-id="<%= m.id %>" class="block bg-gray-900 hover:bg-gray-800/80 border border-gray-800 rounded-xl p-4 transition-colors group">
|
<a href="/dashboard/monitors/<%= m.id %>" data-monitor-id="<%= m.id %>" class="block bg-gray-900 hover:bg-gray-800/80 border border-gray-800 rounded-xl p-4 transition-colors group">
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
|
|||||||
Reference in New Issue
Block a user