@@ -76,17 +76,17 @@ const CourseFilter: FC<ICourseFilterProps> = (props) => {
7676 // Для корректного отображения "Все" при инцициализации (получении данных с бэкенда)
7777 const allCourseStudentsCount = ( course . acceptedStudents ?. length ?? 0 ) + ( course . newStudents ?. length ?? 0 ) ;
7878 const initSelectedStudentsView = selectedStudentWithoutGroups ?. length === allCourseStudentsCount ?
79- [ ] : ( selectedStudentWithoutGroups ) ?? [ ] ;
79+ [ ] : selectedStudentWithoutGroups ?? [ ] ;
8080
8181 const courseHomeworks = initSelectedGroupsView . length > 0
8282 ? course . homeworks ?. filter ( h => ! h . groupId || initSelectedGroupsView ?. some ( g => g . id === h . groupId ) )
8383 : course . homeworks ;
8484 const initSelectedHomeworksView = mentorWorkspace . homeworks ?. length === courseHomeworks ?. length ?
85- [ ] : ( mentorWorkspace . homeworks ?? [ ] )
85+ [ ] : mentorWorkspace . homeworks ?? [ ] ;
8686
8787 setState ( prevState => ( {
8888 ...prevState ,
89- courseHomeworks : courseHomeworks ?? [ ] ,
89+ courseHomeworks : course . homeworks ?? [ ] ,
9090 courseStudents : course . acceptedStudents ?? [ ] ,
9191 courseGroups : course . groups ?. filter ( g => g . name ?. trim ( ) ) ?? [ ] ,
9292 selectedStudents : initSelectedStudentsView . filter ( s => ! initSelectedGroupsView . some ( g => g . studentsIds ?. includes ( s . userId ! ) ) ) ,
@@ -156,7 +156,11 @@ const CourseFilter: FC<ICourseFilterProps> = (props) => {
156156 < Autocomplete
157157 multiple
158158 fullWidth
159- options = { state . courseHomeworks }
159+ options = { state . courseHomeworks . filter ( h =>
160+ ! h . groupId
161+ || ! state . selectedGroups
162+ || state . selectedGroups . some ( g => g . id === h . groupId ) )
163+ }
160164 getOptionLabel = { ( option : HomeworkViewModel ) => option . title ?? "Без названия" }
161165 getOptionKey = { ( option : HomeworkViewModel ) => option . id ?? 0 }
162166 filterSelectedOptions
0 commit comments