From be582edeeb649f7760d91189d06d1a47f90017a8 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Wed, 4 Sep 2024 11:54:20 -0700 Subject: [PATCH] add time --- Client/src/Pages/Monitors/Details/index.jsx | 1 + Server/db/mongo/modules/monitorModule.js | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Client/src/Pages/Monitors/Details/index.jsx b/Client/src/Pages/Monitors/Details/index.jsx index 833e11ef9..4bea7d836 100644 --- a/Client/src/Pages/Monitors/Details/index.jsx +++ b/Client/src/Pages/Monitors/Details/index.jsx @@ -89,6 +89,7 @@ const DetailsPage = ({ isAdmin }) => { 50, true ); + console.log(res.data.data); setMonitor(res?.data?.data ?? {}); } catch (error) { logger.error(error); diff --git a/Server/db/mongo/modules/monitorModule.js b/Server/db/mongo/modules/monitorModule.js index 858976285..44ec99a6d 100644 --- a/Server/db/mongo/modules/monitorModule.js +++ b/Server/db/mongo/modules/monitorModule.js @@ -200,11 +200,11 @@ const getMonitorStatsById = async (req) => { }, {}); } else { groupedChecks = checksForDateRange.reduce((acc, check) => { - const day = new Date(check.createdAt).toISOString().split("T")[0]; // Extract the date part - if (!acc[day]) { - acc[day] = { day, checks: [] }; + const time = new Date(check.createdAt).toISOString().split("T")[0]; // Extract the date part + if (!acc[time]) { + acc[time] = { time, checks: [] }; } - acc[day].checks.push(check); + acc[time].checks.push(check); return acc; }, {}); }