@@ -301,27 +301,29 @@ public async Task<IActionResult> PostSolution(PostSolutionModel model, long task
301301 var result = await _solutionsClient . PostSolution ( taskId , solutionModel ) ;
302302 return Ok ( result ) ;
303303 }
304+ else
305+ {
306+ var fullStudentsGroup = model . GroupMateIds . ToList ( ) ;
307+ fullStudentsGroup . Add ( solutionModel . StudentId ) ;
308+ var arrFullStudentsGroup = fullStudentsGroup . Distinct ( ) . ToArray ( ) ;
304309
305- var fullStudentsGroup = model . GroupMateIds . ToList ( ) ;
306- fullStudentsGroup . Add ( solutionModel . StudentId ) ;
307- var arrFullStudentsGroup = fullStudentsGroup . Distinct ( ) . ToArray ( ) ;
308-
309- if ( arrFullStudentsGroup . Intersect ( course . CourseMates . Select ( x => x . StudentId ) ) . Count ( ) !=
310- arrFullStudentsGroup . Length )
311- return BadRequest ( ) ;
310+ if ( arrFullStudentsGroup . Intersect ( course . CourseMates . Select ( x => x . StudentId ) ) . Count ( ) !=
311+ arrFullStudentsGroup . Length )
312+ return BadRequest ( ) ;
312313
313- var existedGroup = course . Groups . SingleOrDefault ( x =>
314- x . StudentsIds . Length == arrFullStudentsGroup . Length &&
315- x . StudentsIds . Intersect ( arrFullStudentsGroup ) . Count ( ) == arrFullStudentsGroup . Length ) ;
314+ var existedGroup = course . Groups . SingleOrDefault ( x =>
315+ x . StudentsIds . Length == arrFullStudentsGroup . Length &&
316+ x . StudentsIds . Intersect ( arrFullStudentsGroup ) . Count ( ) == arrFullStudentsGroup . Length ) ;
316317
317- solutionModel . GroupId =
318- existedGroup ? . Id ??
319- await _coursesServiceClient . CreateCourseGroup ( new CreateGroupViewModel ( arrFullStudentsGroup , course . Id ) ,
320- taskId ) ;
318+ solutionModel . GroupId =
319+ existedGroup ? . Id ??
320+ await _coursesServiceClient . CreateCourseGroup ( new CreateGroupViewModel ( arrFullStudentsGroup , course . Id ) ,
321+ taskId ) ;
321322
322- await _solutionsClient . PostSolution ( taskId , solutionModel ) ;
323+ var result = await _solutionsClient . PostSolution ( taskId , solutionModel ) ;
323324
324- return Ok ( solutionModel ) ;
325+ return Ok ( result ) ;
326+ }
325327 }
326328
327329 [ HttpPost ( "automated/{courseId}" ) ]
0 commit comments