fix: duplicate studenten in lijst gefilterd

This commit is contained in:
Gabriellvl 2025-05-15 20:53:35 +02:00
parent 26a01f0f30
commit f9fc19d8a6

View file

@ -112,7 +112,13 @@ export async function getStudentsByTeacher(username: string, full: boolean): Pro
const classIds: string[] = classes.map((cls) => cls.id);
const students: StudentDTO[] = (await Promise.all(classIds.map(async (username) => await getClassStudentsDTO(username)))).flat();
const students: StudentDTO[] = (await Promise.all(
classIds.map(async (classId) => await getClassStudentsDTO(classId))
))
.flat()
.filter((student, index, self) =>
self.findIndex((s) => s.username === student.username) === index
);
if (full) {
return students;