fix uptime %
This commit is contained in:
@@ -50,8 +50,14 @@
|
||||
var latRaw = bar.getAttribute("data-latency");
|
||||
var lat = latRaw == null ? null : parseInt(latRaw, 10);
|
||||
if (!start) return;
|
||||
var pct = total > 0 ? Math.round(1000 * up / total) / 10 : null;
|
||||
var pctText = pct == null ? "—" : (pct === 100 ? "100%" : pct.toFixed(1) + "%");
|
||||
// Full precision pct so the formatter can decide. Anything below 100% gets
|
||||
// 2 truncated (not rounded) decimals — same rule as the page-level uptime
|
||||
// numbers, so a bucket with one failed check never displays as "100%".
|
||||
var pct = total > 0 ? (100 * up / total) : null;
|
||||
var pctText;
|
||||
if (pct == null) pctText = "—";
|
||||
else if (pct >= 100) pctText = "100%";
|
||||
else pctText = (Math.floor(pct * 100) / 100).toFixed(2) + "%";
|
||||
var html = '<div class="head">' + fmtBucketRange(start) + "</div>";
|
||||
if (total > 0) {
|
||||
html += '<div class="row"><span>Checks</span><span>' + total + "</span></div>";
|
||||
|
||||
Reference in New Issue
Block a user