Skip to content

Commit 91db612

Browse files
committed
fix: Downtime avg percentage calc
1 parent f8f740e commit 91db612

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

thingconnect.pulse.client/src/components/AvailabilityStats.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ export function AvailabilityStats({
6363

6464
const availabilityPct = totalPoints > 0 ? (upPoints / totalPoints) * 100 : 0;
6565
const avgResponseTime = responseTimeCount > 0 ? totalResponseTime / responseTimeCount : null;
66-
const downEventPct = totalPoints > 0 ? (totalDownEvents / totalPoints) * 100 : 0;
67-
// const downEventPct =
68-
// totalPoints > 0
69-
// ? totalDownEvents / totalPoints // average down events per bucket
70-
// : 0;
66+
let downEventPct = 0;
67+
if (totalPoints > 0) {
68+
if (bucket !== 'daily') downEventPct = (totalDownEvents / totalPoints) * 100;
69+
else downEventPct = totalDownEvents / totalPoints;
70+
}
7171

7272
return {
7373
availabilityPct,

0 commit comments

Comments
 (0)