From 414e8c15ada719fd934bc94334db7f707984dbe8 Mon Sep 17 00:00:00 2001 From: Harshitha Shetty <141444342+HarshithaShetty27@users.noreply.github.com> Date: Tue, 8 Apr 2025 13:13:44 +0530 Subject: [PATCH] course consolidated fixed --- server/routes/consolidatedRoutes.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/routes/consolidatedRoutes.js b/server/routes/consolidatedRoutes.js index 8a7b784..2034dba 100644 --- a/server/routes/consolidatedRoutes.js +++ b/server/routes/consolidatedRoutes.js @@ -14,7 +14,7 @@ router.get("/consolidated-table", async (req, res) => { const groupedData = {}; appointments.forEach((appointment) => { - const key = `${appointment.facultyId}-${appointment.courseId}`; + const key = `${appointment.facultyId}-${appointment.courseId}-${appointment.academicYear}-${appointment.examPeriod}`; if (!groupedData[key]) { groupedData[key] = { facultyId: appointment.facultyId, @@ -32,10 +32,11 @@ router.get("/consolidated-table", async (req, res) => { experience: "20+", // Dummy value tasks: new Set(), // Use a set to avoid duplicate tasks }; - } + } groupedData[key].tasks.add(appointment.task); }); + // Add course details to the grouped data Object.values(groupedData).forEach((data) => { const course = courses.find((c) => c.courseId === data.courseId);