private async Task <RunSolutionResult> CheckSolution(string courseId, ExerciseSlide exerciseSlide, string code) { var exerciseBlock = exerciseSlide.Exercise; var solution = exerciseBlock.Solution.BuildSolution(code); if (solution.HasErrors) { return new RunSolutionResult { IsCompileError = true, CompilationError = solution.ErrorMessage, ExecutionServiceName = "uLearn" } } ; if (solution.HasStyleIssues) { return new RunSolutionResult { IsStyleViolation = true, CompilationError = solution.StyleMessage, ExecutionServiceName = "uLearn" } } ; var submissionDetails = await solutionsRepo.RunUserSolution( courseId, exerciseSlide.Id, User.Identity.GetUserId(), code, null, null, false, "uLearn", GenerateSubmissionName(exerciseSlide), executionTimeout ); if (submissionDetails == null) { return new RunSolutionResult { IsCompillerFailure = true, CompilationError = "Ой-ой, штуковина, которая проверяет решения сломалась (или просто устала). Попробуйте отправить решение позже (когда она немного отдохнет).", ExecutionServiceName = "uLearn" } } ; var output = submissionDetails.Output.Text; var expectedOutput = exerciseBlock.ExpectedOutput.NormalizeEoln(); var isRightAnswer = submissionDetails.GetVerdict() == "Accepted" && output.Equals(expectedOutput); await visitsRepo.AddSolutionAttempt(exerciseSlide.Id, User.Identity.GetUserId(), isRightAnswer); return(new RunSolutionResult { IsCompileError = submissionDetails.IsCompilationError, CompilationError = submissionDetails.CompilationError.Text, IsRightAnswer = isRightAnswer, ExpectedOutput = exerciseBlock.HideExpectedOutputOnError ? null : expectedOutput, ActualOutput = output, ExecutionServiceName = submissionDetails.ExecutionServiceName }); }