course consolidated fixed

This commit is contained in:
Harshitha Shetty
2025-04-08 13:13:44 +05:30
parent 4c8b0839a4
commit 414e8c15ad

View File

@@ -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);