|
@@ -123,7 +123,6 @@ namespace WingEducationService.Service
|
|
|
var userCode = await GetClientIdByTokenAsync(request.Token);
|
|
|
var courseCode = request.CourseCode;
|
|
|
var code = request.Code; //考试编码
|
|
|
- var answers = request.Answers;
|
|
|
if (string.IsNullOrEmpty(courseCode))
|
|
|
{
|
|
|
ThrowRpcException(CustomerRpcCode.CourseCodeEmpty, "Course code is empty");
|
|
@@ -150,6 +149,12 @@ namespace WingEducationService.Service
|
|
|
RelevanceType = RelevanceTypeEnum.Course
|
|
|
});
|
|
|
var studentExaminationCode = "";
|
|
|
+ //学生作答答案
|
|
|
+ var answers = request.Answers.MappingTo<List<ExaminationAnswerDTO>>();
|
|
|
+ foreach (var item in answers)
|
|
|
+ {
|
|
|
+ item.QuestionType = existExam.QuestionList.FirstOrDefault(x => x.Code == item.QuestionCode).QuestionType;
|
|
|
+ }
|
|
|
if (result == null || result.TotalCount <= 0)
|
|
|
{
|
|
|
studentExaminationCode = await _educationDBService.CreateStudentExaminationDBAsync(new AddStudentExaminationDBRequest()
|
|
@@ -158,7 +163,7 @@ namespace WingEducationService.Service
|
|
|
{
|
|
|
RelevanceCode = courseCode,
|
|
|
RelevanceType = RelevanceTypeEnum.Course,
|
|
|
- StudentAnswers = answers.MappingTo<List<ExaminationAnswerDTO>>(),//todo
|
|
|
+ StudentAnswers = answers,
|
|
|
SubmitCount = 1
|
|
|
}
|
|
|
});
|
|
@@ -173,7 +178,7 @@ namespace WingEducationService.Service
|
|
|
{
|
|
|
ThrowRpcException(CustomerRpcCode.SubmitCountError, "Submit Time Error");
|
|
|
}
|
|
|
- studentExamination.StudentAnswers = answers.MappingTo<List<ExaminationAnswerDTO>>();//todo
|
|
|
+ studentExamination.StudentAnswers = answers;
|
|
|
studentExamination.SubmitCount += 1;
|
|
|
await _educationDBService.UpdateStudentExaminationDBAsync(new UpdateStudentExaminationDBRequest()
|
|
|
{
|
|
@@ -397,7 +402,6 @@ namespace WingEducationService.Service
|
|
|
{
|
|
|
var userCode = await GetClientIdByTokenAsync(request.Token);
|
|
|
var code = request.Code;
|
|
|
- var answers = request.Answers;
|
|
|
if (string.IsNullOrEmpty(code))
|
|
|
{
|
|
|
ThrowRpcException(CustomerRpcCode.ExaminationCodeIsEmpty, "Code is empty");
|
|
@@ -410,11 +414,22 @@ namespace WingEducationService.Service
|
|
|
{
|
|
|
ThrowRpcException(CustomerRpcCode.StudentExaminationNoFound, "Student examination data no found");
|
|
|
}
|
|
|
- result.StudentAnswers = answers.MappingTo<List<ExaminationAnswerDTO>>();//todo
|
|
|
+ var answers = request.Answers.MappingTo<List<ExaminationAnswerDTO>>();
|
|
|
+ if (result.RelevanceType == RelevanceTypeEnum.Course)//课程
|
|
|
+ {
|
|
|
+ var existCourse = await _courseDBService.FindCourseByCodeAsync(new FindCourseByCodeDBRequest() { Code = result.RelevanceCode });
|
|
|
+ var existExam = existCourse.BindExams.FirstOrDefault(c => c.Code == result.ExaminationCode); //考试数据
|
|
|
+ foreach (var item in answers)
|
|
|
+ {
|
|
|
+ item.QuestionType = existExam.QuestionList.FirstOrDefault(x => x.Code == item.QuestionCode).QuestionType;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.StudentAnswers = answers;
|
|
|
return await _educationDBService.UpdateStudentExaminationDBAsync(new UpdateStudentExaminationDBRequest()
|
|
|
{
|
|
|
StudentExamination = result
|
|
|
});
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// <summary>
|