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 = {}; const groupedData = {};
appointments.forEach((appointment) => { appointments.forEach((appointment) => {
const key = `${appointment.facultyId}-${appointment.courseId}`; const key = `${appointment.facultyId}-${appointment.courseId}-${appointment.academicYear}-${appointment.examPeriod}`;
if (!groupedData[key]) { if (!groupedData[key]) {
groupedData[key] = { groupedData[key] = {
facultyId: appointment.facultyId, facultyId: appointment.facultyId,
@@ -36,6 +36,7 @@ router.get("/consolidated-table", async (req, res) => {
groupedData[key].tasks.add(appointment.task); groupedData[key].tasks.add(appointment.task);
}); });
// Add course details to the grouped data // Add course details to the grouped data
Object.values(groupedData).forEach((data) => { Object.values(groupedData).forEach((data) => {
const course = courses.find((c) => c.courseId === data.courseId); const course = courses.find((c) => c.courseId === data.courseId);