add uptimePercentage to aggregate data

This commit is contained in:
Alex Holliday committed 2024-09-04 13:21:51 -07:00
1 parent 6424a0436f
commit 70a4058993
1 file changed
+2
+2
View File
@@ -212,6 +212,7 @@ const getMonitorStatsById = async (req) => {
// Map grouped checks to stats
const aggregateData = Object.values(groupedChecks).map((group) => {
const totalChecks = group.checks.length;
const uptimePercentage = getUptimePercentage(group.checks);
const totalIncidents = group.checks.filter(
(check) => check.status === false
).length;
@@ -221,6 +222,7 @@ const getMonitorStatsById = async (req) => {
return {
time: group.time,
uptimePercentage,
totalChecks,
totalIncidents,
avgResponseTime,