diff --git a/frontend/src/components/export/ExportDialog.vue b/frontend/src/components/export/ExportDialog.vue index 506afc282b5e5082a718babda4a2a60eb0dd80dd..8d4eac7e5cb7efd77742289c5f27a4a47b63f9e4 100644 --- a/frontend/src/components/export/ExportDialog.vue +++ b/frontend/src/components/export/ExportDialog.vue @@ -42,11 +42,20 @@ :prepend-icon="null" /> <v-alert - v-if="studentsAreMissingFromMap" + v-if="studentsMissingFromMap.length > 0" type="warning" class="mt-4 mb-0" > - Some students are missing from the mapping file. You can still export, but the missing students will remain anonymized. + <p>Some students are missing from the mapping file. You can still export, but the missing students will remain anonymized.</p> + <p>These students are missing:</p> + <ul class="missing-student-list"> + <li + v-for="student in studentsMissingFromMap" + :key="student.matrikelNo" + > + {{ student.name }} + </li> + </ul> </v-alert> </v-card-text> <v-card-actions class="justify-end"> @@ -129,13 +138,6 @@ function validateMapFile(content: unknown): content is StudentMap { ) } -function mapHasAllStudents(allStudents: StudentInfoForListView[], map: StudentMap): boolean { - console.log(map) - return allStudents.every( - student => student.matrikelNo === undefined || map[student.matrikelNo] !== undefined - ) -} - function mapInstanceData(map: StudentMap, instanceExport: InstanceExportData): InstanceExportData { return {...instanceExport, students: instanceExport.students.map(student => { if (map[student.matrikelNo]) @@ -180,7 +182,8 @@ export default Vue.extend({ mapFileLoading: false, setPasswords: false, exportType: ExportType.StudentScores, - studentsAreMissingFromMap: false, + studentsMissingFromMap: [] as StudentInfoForListView[], + showMissingStudents: false, } }, computed: { @@ -219,7 +222,12 @@ export default Vue.extend({ }, async map(newMap) { - this.studentsAreMissingFromMap = newMap !== null && !mapHasAllStudents(await fetchAllStudents(), newMap) + if (newMap !== null) + this.studentsMissingFromMap = (await fetchAllStudents()).filter( + student => student.matrikelNo && !newMap[student.matrikelNo] + ) + else + this.studentsMissingFromMap = [] } }, methods: { @@ -248,4 +256,8 @@ export default Vue.extend({ </script> <style scoped> + .missing-student-list { + max-height: 100px; + overflow: auto; + } </style>