From 70a40589933de0987255ea696457a49743ec4b28 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Wed, 4 Sep 2024 13:21:51 -0700 Subject: [PATCH] add uptimePercentage to aggregate data --- Server/db/mongo/modules/monitorModule.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Server/db/mongo/modules/monitorModule.js b/Server/db/mongo/modules/monitorModule.js index 29e98fc2c..558fbae4d 100644 --- a/Server/db/mongo/modules/monitorModule.js +++ b/Server/db/mongo/modules/monitorModule.js @@ -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,