fix: duplicate studenten in lijst gefilterd
This commit is contained in:
		
							parent
							
								
									26a01f0f30
								
							
						
					
					
						commit
						f9fc19d8a6
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		|  | @ -112,7 +112,13 @@ export async function getStudentsByTeacher(username: string, full: boolean): Pro | ||||||
| 
 | 
 | ||||||
|     const classIds: string[] = classes.map((cls) => cls.id); |     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) { |     if (full) { | ||||||
|         return students; |         return students; | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Gabriellvl
						Gabriellvl