Merge pull request #1753 from bluewave-labs/fix/fe/uptime-calculation
fix: correctly calculate grouped uptime percentage, resolves #1684
This commit is contained in:
1 file changed
+7
-5
@@ -30,6 +30,12 @@ const ChartBoxes = ({
|
||||
return <SkeletonLayout />;
|
||||
}
|
||||
|
||||
const totalUpChecks = monitor?.upChecks?.totalChecks ?? 0;
|
||||
const totalDownChecks = monitor?.downChecks?.totalChecks ?? 0;
|
||||
const denominator =
|
||||
totalUpChecks + totalDownChecks > 0 ? totalUpChecks + totalDownChecks : 1;
|
||||
const groupedUptimePercentage = (totalUpChecks / denominator) * 100;
|
||||
|
||||
return (
|
||||
<Stack
|
||||
direction="row"
|
||||
@@ -73,11 +79,7 @@ const ChartBoxes = ({
|
||||
<Typography component="span">
|
||||
{hoveredUptimeData !== null
|
||||
? Math.floor(hoveredUptimeData?.avgResponseTime ?? 0)
|
||||
: Math.floor(
|
||||
((monitor?.upChecks?.totalChecks ?? 0) /
|
||||
(monitor?.totalChecks ?? 1)) *
|
||||
100
|
||||
)}
|
||||
: Math.floor(groupedUptimePercentage)}
|
||||
<Typography component="span">
|
||||
{hoveredUptimeData !== null ? " ms" : " %"}
|
||||
</Typography>
|
||||
|
||||
Reference in new issue
Block a user