fix: avgLatency NaN — extract .latency_ms from ping objects
This commit is contained in:
parent
07648672ad
commit
e057a65535
|
|
@ -25,7 +25,8 @@
|
|||
<% } else { %>
|
||||
<% it.monitors.forEach(function(m) {
|
||||
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">
|
||||
<div class="flex items-center justify-between">
|
||||
|
|
|
|||
Loading…
Reference in New Issue