|
@@ -340,19 +340,17 @@ namespace Hotline.Application.Exam.Service.ExamManages
|
|
return startExamViewResponse;
|
|
return startExamViewResponse;
|
|
}
|
|
}
|
|
|
|
|
|
- userExam.ExamStatus = Share.Enums.Exams.EExamStatus.Executing;
|
|
|
|
|
|
+ if (userExam.ExamStatus == EExamStatus.NoStart)
|
|
|
|
+ {
|
|
|
|
+ userExam.ExamStatus = Share.Enums.Exams.EExamStatus.Executing;
|
|
|
|
|
|
- userExam.ToUpdate(_sessionContext);
|
|
|
|
|
|
+ userExam.ToUpdate(_sessionContext);
|
|
|
|
|
|
- await _repository.UpdateWithValidateAsync(userExam, cancellationToken);
|
|
|
|
-
|
|
|
|
|
|
+ await _repository.UpdateWithValidateAsync(userExam, cancellationToken);
|
|
|
|
|
|
|
|
+ }
|
|
var examManage = await _examManageRepository.GetAsync(x => x.Id == userExam.ExamId);
|
|
var examManage = await _examManageRepository.GetAsync(x => x.Id == userExam.ExamId);
|
|
|
|
|
|
- examManage.ExamStatus = EExamStatus.Executing;
|
|
|
|
-
|
|
|
|
- await _examManageRepository.UpdateWithValidateAsync(examManage, cancellationToken);
|
|
|
|
-
|
|
|
|
return new StartExamViewResponse
|
|
return new StartExamViewResponse
|
|
{
|
|
{
|
|
StartTime = userExam.StartTime,
|
|
StartTime = userExam.StartTime,
|
|
@@ -551,13 +549,13 @@ namespace Hotline.Application.Exam.Service.ExamManages
|
|
var questionScoreTable = questionScoreRepository.Queryable();
|
|
var questionScoreTable = questionScoreRepository.Queryable();
|
|
|
|
|
|
var queryable = userExamTable.InnerJoin(userExamItemTable, (e, i) => e.Id == i.UserExamId)
|
|
var queryable = userExamTable.InnerJoin(userExamItemTable, (e, i) => e.Id == i.UserExamId)
|
|
- .InnerJoin(questionTable, (e, i, q) => i.QuestionId == q.Id)
|
|
|
|
|
|
+ .InnerJoin(questionTable, (e, i, q) => i.QuestionId == q.QuestionId)
|
|
.LeftJoin(userExamItemOptionTable, (e, i, q, o) => i.Id == o.UserExamItemId)
|
|
.LeftJoin(userExamItemOptionTable, (e, i, q, o) => i.Id == o.UserExamItemId)
|
|
.LeftJoin(quesitonOptionTable, (e, i, q, o, qo) => o.QuestionOptionId == qo.Id)
|
|
.LeftJoin(quesitonOptionTable, (e, i, q, o, qo) => o.QuestionOptionId == qo.Id)
|
|
.LeftJoin(examAnswerTable, (e, i, q, o, qo, a) => i.Id == a.UserExamItemId)
|
|
.LeftJoin(examAnswerTable, (e, i, q, o, qo, a) => i.Id == a.UserExamItemId)
|
|
.LeftJoin(testPaperItemAnswerTable, (e, i, q, o, qo, a, ta) => ta.QuestionId == qo.QuestionId)
|
|
.LeftJoin(testPaperItemAnswerTable, (e, i, q, o, qo, a, ta) => ta.QuestionId == qo.QuestionId)
|
|
.InnerJoin(questionScoreTable, (e, i, q, o, qo, a, ta, s) => q.QuestionType == s.QuestionType && e.ExamId == s.ExamManageId)
|
|
.InnerJoin(questionScoreTable, (e, i, q, o, qo, a, ta, s) => q.QuestionType == s.QuestionType && e.ExamId == s.ExamManageId)
|
|
- .Where((e, i, q, o, qo, a, ta, s) => q.QuestionType == EQuestionType.Single || q.QuestionType == EQuestionType.Multi || q.QuestionType == EQuestionType.Judge)
|
|
|
|
|
|
+ .Where((e, i, q, o, qo, a, ta, s) => !(q.QuestionType == EQuestionType.Single || q.QuestionType == EQuestionType.Multi || q.QuestionType == EQuestionType.Judge))
|
|
.Select(
|
|
.Select(
|
|
(e, i, q, o, qo, a, ta, s) => new GradingExamQuestionTempDto
|
|
(e, i, q, o, qo, a, ta, s) => new GradingExamQuestionTempDto
|
|
{
|
|
{
|
|
@@ -589,7 +587,7 @@ namespace Hotline.Application.Exam.Service.ExamManages
|
|
Id = g.Key.Id,
|
|
Id = g.Key.Id,
|
|
Score = g.FirstOrDefault().Score,
|
|
Score = g.FirstOrDefault().Score,
|
|
Title = g.FirstOrDefault().Title,
|
|
Title = g.FirstOrDefault().Title,
|
|
- CorrectAnswer = g.Key.QuestionType.CheckSelectType() ? string.Join(",", g.Where(i => i.IsAnswer).Select(n => n.Label)) : g.FirstOrDefault()?.CorrectAnswer
|
|
|
|
|
|
+ CorrectAnswer = g.Key.QuestionType.CheckSelectType() ? string.Join(",", g.Where(i => i.IsAnswer).Select(n => n.Label).Distinct()) : g.FirstOrDefault()?.CorrectAnswer
|
|
}).ToList();
|
|
}).ToList();
|
|
|
|
|
|
return gradingExamQuestionDtos;
|
|
return gradingExamQuestionDtos;
|