|
|
|
@ -37,18 +37,14 @@ public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDt |
|
|
|
|
{ |
|
|
|
|
var data1 = await BaseDal.QueryFilterPage(body); |
|
|
|
|
var data = Mapper.Map(data1.result.DT_TableDataT1).ToANew<List<Ghre_QuestionDto>>(); |
|
|
|
|
var courseIds = data.Where(x => x.CourseId != null).Select(x => x.CourseId).ToList(); |
|
|
|
|
var courseIds = data.Where(x => x.CourseId != null).Select(x => x.CourseId).Distinct().ToList(); |
|
|
|
|
|
|
|
|
|
var courses = await _ghre_CourseServices.Query(x => courseIds.Contains(x.Id)); |
|
|
|
|
var classs = await _ghre_CourseClassServices.Query(); |
|
|
|
|
var classsIds = courses.Select(x => x.CourseClassId).Distinct().ToList(); |
|
|
|
|
var classs = await _ghre_CourseClassServices.Query(x => classsIds.Contains(x.Id)); |
|
|
|
|
data.ForEach(x => |
|
|
|
|
{ |
|
|
|
|
if (x.DifficultyLevel == "Easy") |
|
|
|
|
x.DifficultyLevel = "简单"; |
|
|
|
|
else if (x.DifficultyLevel == "Normal") |
|
|
|
|
x.DifficultyLevel = "普通"; |
|
|
|
|
else if (x.DifficultyLevel == "Hard") |
|
|
|
|
x.DifficultyLevel = "困难"; |
|
|
|
|
x.DifficultyLevel = ConvertDifficultyLevel(x.DifficultyLevel); |
|
|
|
|
x.QuestionType = ConvertQuestionType(x.QuestionType); |
|
|
|
|
|
|
|
|
|
if (x.CourseId != null) |
|
|
|
@ -493,7 +489,7 @@ public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDt |
|
|
|
|
throw new Exception("答案选项必填!"); |
|
|
|
|
if (questionType.detail.answerList.Count < 2) |
|
|
|
|
throw new Exception("答案选项不能少于两个!"); |
|
|
|
|
if (string.IsNullOrWhiteSpace( questionType.detail.answer ) && (questionType.detail.answer is null || (questionType.detail.answer != null && !questionType.detail.answerList.Any()))) |
|
|
|
|
if (string.IsNullOrWhiteSpace(questionType.detail.answer) && (questionType.detail.answer is null || (questionType.detail.answer != null && !questionType.detail.answerList.Any()))) |
|
|
|
|
throw new Exception("正确答案未标记!"); |
|
|
|
|
} |
|
|
|
|
} |