diff --git a/controllers/courses.js b/controllers/courses.js index c253f67592..144601e9a0 100644 --- a/controllers/courses.js +++ b/controllers/courses.js @@ -64,7 +64,6 @@ const getSyncedElements = ( classesAndGroups, classAndGroupIdsOfCourse, teachers, - substitutions, students, res, syncedWithGroup, @@ -78,7 +77,7 @@ const getSyncedElements = ( const selectedElements = { teachersSelected: selectedElementIdsToString(markSelected(teachers, course.teacherIds)), - substitutionSelected: selectedElementIdsToString(markSelected(substitutions, course.substitutionIds)), + substitutionSelected: selectedElementIdsToString(markSelected(teachers, course.substitutionIds)), classesAndGroupsSelected: selectedElementIdsToString(markSelected(classesAndGroups, classAndGroupIdsOfCourse)), studentsSelected: selectedElementIdsToString(filterStudents(res, markSelected(students, course.userIds))), startDate, @@ -249,9 +248,6 @@ const editCourseHandler = (req, res, next) => { students.forEach((student) => { student.isHidden = isUserHidden(student, res.locals.currentSchoolData); }); - const substitutions = _.cloneDeep( - teachers, - ); // decode course name to display it properly in an input field if (course.name) { @@ -331,7 +327,6 @@ const editCourseHandler = (req, res, next) => { classesAndGroups, classAndGroupIdsOfCourse, teachers, - substitutions, students, res, syncedGroupId, @@ -349,7 +344,7 @@ const editCourseHandler = (req, res, next) => { colors, classesAndGroups: markSelected(classesAndGroups, classAndGroupIdsOfCourse), teachers: markSelected(teachers, course.teacherIds), - substitutions: markSelected(substitutions, course.substitutionIds), + substitutions: markSelected(teachers, course.substitutionIds), students: filterStudents(res, markSelected(students, course.userIds)), scopePermissions: _scopePermissions, schoolData: res.locals.currentSchoolData, @@ -366,7 +361,7 @@ const editCourseHandler = (req, res, next) => { colors, classesAndGroups: markSelected(classesAndGroups, classAndGroupIdsOfCourse), teachers: markSelected(teachers, course.teacherIds), - substitutions: markSelected(substitutions, course.substitutionIds), + substitutions: markSelected(teachers, course.substitutionIds), students: filterStudents(res, markSelected(students, course.userIds)), redirectUrl: req.query.redirectUrl || '/courses', schoolData: res.locals.currentSchoolData,