course consolidated fixed
This commit is contained in:
@@ -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,
|
||||||
@@ -32,10 +32,11 @@ router.get("/consolidated-table", async (req, res) => {
|
|||||||
experience: "20+", // Dummy value
|
experience: "20+", // Dummy value
|
||||||
tasks: new Set(), // Use a set to avoid duplicate tasks
|
tasks: new Set(), // Use a set to avoid duplicate tasks
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user