File tree Expand file tree Collapse file tree
HwProj.CoursesService/HwProj.CoursesService.API/Services
hwproj.front/src/components/Courses Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -140,22 +140,21 @@ public async Task<MentorToAssignedStudentsDTO[]> GetAssignedStudentsIds(long cou
140140 . Distinct ( )
141141 . ToArray ( ) ;
142142
143- var groupToStudents = groupIds . Any ( )
144- ? ( await _groupsService . GetGroupsAsync ( groupIds ) )
145- . ToDictionary (
146- g => g . Id ,
147- g => g . GroupMates ? . Select ( gm => gm . StudentId ) . ToArray ( ) ?? Array . Empty < string > ( )
148- )
149- : new Dictionary < long , string [ ] > ( ) ;
143+ var groups = await _groupsService . GetGroupsAsync ( groupIds ) ;
144+ var groupToStudentIds = groups
145+ . ToDictionary (
146+ g => g . Id ,
147+ g => g . GroupMates ? . Select ( gm => gm . StudentId ) . ToArray ( ) ?? Array . Empty < string > ( )
148+ ) ;
150149
151150 var result = usersCourseFilters
152151 . Select ( u =>
153152 {
154153 var directStudents = u . CourseFilter . Filter . StudentIds ?? new List < string > ( ) { } ;
155154 var groupIdsForMentor = u . CourseFilter . Filter . GroupIds ?? Enumerable . Empty < long > ( ) ;
156155 var studentsFromGroups = groupIdsForMentor
157- . Where ( gid => groupToStudents . ContainsKey ( gid ) )
158- . SelectMany ( gid => groupToStudents [ gid ] )
156+ . Where ( gid => groupToStudentIds . ContainsKey ( gid ) )
157+ . SelectMany ( gid => groupToStudentIds [ gid ] )
159158 . Distinct ( )
160159 . ToList ( ) ;
161160
Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ const Course: React.FC = () => {
158158
159159 useEffect ( ( ) => {
160160 setCurrentState ( )
161- } , [ courseId ] )
161+ } , [ ] )
162162
163163 useEffect ( ( ) => {
164164 ApiSingleton . statisticsApi . statisticsGetCourseStatistics ( + courseId ! )
You can’t perform that action at this time.
0 commit comments