@@ -970,7 +970,6 @@ async function getExam() {
970970 }
971971
972972 examStore .selectedExam = examResponse ;
973- filterOutTeacherUser ();
974973 isSEBLockActive .value = await examService .checkSEBLock (examId );
975974 isExcludeFromDeletionActive .value =
976975 examStore .selectedExam .excludeFromDeletion ;
@@ -1003,7 +1002,6 @@ async function updateExam(isSupervisorsManualUpdate?: boolean) {
10031002 alertKey .value = " exam-update-successful" ;
10041003
10051004 examStore .selectedExam = updateExamResponse ;
1006- filterOutTeacherUser ();
10071005 isExcludeFromDeletionActive .value =
10081006 examStore .selectedExam .excludeFromDeletion ;
10091007
@@ -1146,7 +1144,6 @@ async function changeSEBLock(enable: boolean) {
11461144 }
11471145
11481146 examStore .selectedExam = applySEBLockResponse ;
1149- filterOutTeacherUser ();
11501147}
11511148
11521149// SEB Lock
@@ -1164,9 +1161,6 @@ async function applySEBLockService(
11641161}
11651162
11661163// = ==============supervisors logic====================
1167- // TODO @anhefti: This is just to satisfy the linter for the moment (how can we just ignore an error after catch? )
1168- // To solve this in the backend, make sure the backend only and always returns valid user UUIDs within the supporter field
1169- const error = ref <string >();
11701164async function getExamSupervisors() {
11711165 if (examStore .selectedExam ?.supporter == null ) {
11721166 return ;
@@ -1179,42 +1173,15 @@ async function getExamSupervisors() {
11791173
11801174 examStore .clearSelectedSupervisors ();
11811175 for (let i = 0 ; i < examStore .selectedExam .supporter .length ; i ++ ) {
1182- try {
1183- const userAccount: UserAccount | null =
1184- await userAccountService .getUserAccountById (
1185- examStore .selectedExam .supporter [i ],
1186- );
1187-
1188- if (userAccount !== null && userAccount !== undefined ) {
1189- examStore .selectedExamSupervisors .push (userAccount );
1190- }
1191- } catch (err ) {
1192- error .value = err instanceof Error ? err .message : " Unknown error" ;
1193- }
1194- }
1195- }
1196-
1197- // TODO @anhefti: This is a workaround since teacher accounts are not selectable and also should not be sent on save
1198- // Ideally the Backend should provide only selectable supporter within the Exam when fetching but
1199- // to achieve this we have to figure out when to do this ideally since in the back-end the teacher accounts are needed
1200- // one solution would be to use a dedicated endpoint to fetch the Exam for the GUI
1201- function filterOutTeacherUser() {
1202- if (! examStore .selectedExam ) {
1203- return ;
1204- }
1205- if (examStore .selectedExam .supporter .length == 0 ) {
1206- return ;
1207- }
1176+ const userAccount: UserAccount | null =
1177+ await userAccountService .getUserAccountById (
1178+ examStore .selectedExam .supporter [i ],
1179+ );
12081180
1209- const filteredSupporter: string [] = [];
1210- for (let i = 0 ; i < examStore .selectedExam .supporter .length ; i ++ ) {
1211- if (
1212- ! examStore .selectedExam .supporter [i ].startsWith (" TEACHER_ACCOUNT__" )
1213- ) {
1214- filteredSupporter .push (examStore .selectedExam .supporter [i ]);
1181+ if (userAccount !== null && userAccount !== undefined ) {
1182+ examStore .selectedExamSupervisors .push (userAccount );
12151183 }
12161184 }
1217- examStore .selectedExam .supporter = filteredSupporter ;
12181185}
12191186
12201187function openSupervisorsDialog() {
@@ -1332,7 +1299,6 @@ async function changeScreenProctoringSettings(enable: boolean) {
13321299 }
13331300
13341301 examStore .selectedExam = saveScreenProcResponse ;
1335- filterOutTeacherUser ();
13361302}
13371303
13381304// = ==============delete exam logic====================
0 commit comments