1111using  HwProj . Models . CoursesService . ViewModels ; 
1212using  HwProj . Models . Roles ; 
1313using  HwProj . Models . SolutionsService ; 
14- using  HwProj . Models . StatisticsService ; 
1514using  HwProj . SolutionsService . Client ; 
1615using  Microsoft . AspNetCore . Authorization ; 
1716using  Microsoft . AspNetCore . Mvc ; 
@@ -136,47 +135,6 @@ public async Task<IActionResult> GetTaskSolutionsPageData(long taskId)
136135            return  Ok ( result ) ; 
137136        } 
138137
139-         [ Authorize ] 
140-         [ HttpGet ( "tasks/{taskId}" ) ] 
141-         [ ProducesResponseType ( typeof ( TaskSolutionStatisticsPageData ) ,  ( int ) HttpStatusCode . OK ) ] 
142-         public  async  Task < IActionResult >  GetTaskSolutionsPageData ( long  taskId ) 
143-         { 
144-             var  course  =  await  _coursesServiceClient . GetCourseByTask ( taskId ) ; 
145-             //TODO: CourseMentorOnlyAttribute 
146-             if  ( course  ==  null  ||  ! course . MentorIds . Contains ( UserId ) )  return  Forbid ( ) ; 
147- 
148-             var  studentIds  =  course . CourseMates 
149-                 . Where ( t =>  t . IsAccepted ) 
150-                 . Select ( t =>  t . StudentId ) 
151-                 . ToArray ( ) ; 
152- 
153-             var  getStudentsDataTask  =  AuthServiceClient . GetAccountsData ( studentIds ) ; 
154-             var  getStatisticsTask  =  _solutionsClient . GetTaskSolutionStatistics ( taskId ) ; 
155- 
156-             await  Task . WhenAll ( getStudentsDataTask ,  getStatisticsTask ) ; 
157- 
158-             var  usersData  =  getStudentsDataTask . Result ; 
159-             var  statistics  =  getStatisticsTask . Result ; 
160-             var  statisticsDict  =  statistics . ToDictionary ( t =>  t . StudentId ) ; 
161- 
162-             var  result  =  new  TaskSolutionStatisticsPageData ( ) 
163-             { 
164-                 CourseId  =  course . Id , 
165-                 StudentsSolutions  =  studentIds . Zip ( usersData ,  ( studentId ,  accountData )  =>  new  UserTaskSolutions 
166-                     { 
167-                         Solutions  =  statisticsDict . TryGetValue ( studentId ,  out  var  studentSolutions ) 
168-                             ?  studentSolutions . Solutions 
169-                             :  Array . Empty < Solution > ( ) , 
170-                         User  =  accountData 
171-                     } ) 
172-                     . OrderBy ( t =>  t . User . Surname ) 
173-                     . ThenBy ( t =>  t . User . Name ) 
174-                     . ToArray ( ) 
175-             } ; 
176- 
177-             return  Ok ( result ) ; 
178-         } 
179- 
180138        [ HttpPost ( "{taskId}" ) ] 
181139        [ Authorize ( Roles  =  Roles . StudentRole ) ] 
182140        [ ProducesResponseType ( typeof ( long ) ,  ( int ) HttpStatusCode . OK ) ] 
@@ -233,19 +191,6 @@ public async Task<IActionResult> PostEmptySolutionWithRate(long taskId, Solution
233191            return  Ok ( ) ; 
234192        } 
235193
236-         [ HttpPost ( "rateEmptySolution/{taskId}" ) ] 
237-         [ Authorize ( Roles  =  Roles . LecturerRole ) ] 
238-         public  async  Task < IActionResult >  PostEmptySolutionWithRate ( long  taskId ,  SolutionViewModel  model ) 
239-         { 
240-             var  course  =  await  _coursesServiceClient . GetCourseByTask ( taskId ) ; 
241-             if  ( course  ==  null  ||  ! course . MentorIds . Contains ( UserId ) )  return  Forbid ( ) ; 
242-             if  ( course . CourseMates . All ( t =>  t . StudentId  !=  model . StudentId ) ) 
243-                 return  BadRequest ( $ "Студента с id { model . StudentId }  не существует") ; 
244- 
245-             await  _solutionsClient . PostEmptySolutionWithRate ( taskId ,  model ) ; 
246-             return  Ok ( ) ; 
247-         } 
248- 
249194        [ HttpPost ( "rateSolution/{solutionId}/{newRating}" ) ] 
250195        [ Authorize ( Roles  =  Roles . LecturerRole ) ] 
251196        public  async  Task < IActionResult >  RateSolution ( long  solutionId ,  int  newRating , 
@@ -329,4 +274,4 @@ public async Task<UnratedSolutionPreviews> GetUnratedSolutions(long? taskId)
329274            } 
330275        } 
331276    } 
332- } 
277+ } 
0 commit comments