Commit c984b64b authored by 黄奎's avatar 黄奎

页面修改

parent a310383b
...@@ -433,7 +433,7 @@ namespace Edu.Module.Exam ...@@ -433,7 +433,7 @@ namespace Edu.Module.Exam
PaperType = 1, PaperType = 1,
ParentId = model.ParentId, ParentId = model.ParentId,
IsOpen = model.IsOpen, IsOpen = model.IsOpen,
GroupType=model.GroupType, GroupType = model.GroupType,
}; };
newPaperId = examination_PaperRepository.Insert(paperModel); newPaperId = examination_PaperRepository.Insert(paperModel);
paperModel.PaperId = newPaperId; paperModel.PaperId = newPaperId;
...@@ -460,8 +460,8 @@ namespace Edu.Module.Exam ...@@ -460,8 +460,8 @@ namespace Edu.Module.Exam
PaperType = 2, PaperType = 2,
ParentId = newPaperId, ParentId = newPaperId,
IsOpen = model.IsOpen, IsOpen = model.IsOpen,
GroupType=model.GroupType, GroupType = model.GroupType,
PaperScore=model.TemplateScore, PaperScore = model.TemplateScore,
}; };
var newSubPaperId = examination_PaperRepository.Insert(subModel); var newSubPaperId = examination_PaperRepository.Insert(subModel);
subModel.PaperId = newSubPaperId; subModel.PaperId = newSubPaperId;
...@@ -504,9 +504,9 @@ namespace Edu.Module.Exam ...@@ -504,9 +504,9 @@ namespace Edu.Module.Exam
PaperId = subModel.PaperId, PaperId = subModel.PaperId,
GroupName = !string.IsNullOrEmpty(item.QuestionDesc) ? item.QuestionDesc : item.QuestionTypeName, GroupName = !string.IsNullOrEmpty(item.QuestionDesc) ? item.QuestionDesc : item.QuestionTypeName,
GSortNum = G_Sort, GSortNum = G_Sort,
GScore=item.QuestionScore, GScore = item.QuestionScore,
QuestionTypeKey = item.QuestionTypeKey, QuestionTypeKey = item.QuestionTypeKey,
GroupType=model.GroupType, GroupType = model.GroupType,
}; };
if (model.GroupType == ExamGroupTypeEnum.QuestionType) if (model.GroupType == ExamGroupTypeEnum.QuestionType)
{ {
...@@ -528,7 +528,7 @@ namespace Edu.Module.Exam ...@@ -528,7 +528,7 @@ namespace Edu.Module.Exam
var detailsModel = new RB_Examination_Details_ViewModel() var detailsModel = new RB_Examination_Details_ViewModel()
{ {
Id = 0, Id = 0,
GId= groupModel.GId, GId = groupModel.GId,
PaperId = subModel.PaperId, PaperId = subModel.PaperId,
BankId = qItem.BankId, BankId = qItem.BankId,
QuestionId = qItem.QuestionId, QuestionId = qItem.QuestionId,
...@@ -575,6 +575,8 @@ namespace Edu.Module.Exam ...@@ -575,6 +575,8 @@ namespace Edu.Module.Exam
detailsModel.QuestionContent = JsonHelper.Serialize(clozeList); detailsModel.QuestionContent = JsonHelper.Serialize(clozeList);
} }
else if (qItem.QuestionTypeKey == "listening" || qItem.QuestionTypeKey == "reading-comprehensio") else if (qItem.QuestionTypeKey == "listening" || qItem.QuestionTypeKey == "reading-comprehensio")
{
try
{ {
List<readingComprehensioItem> readingList = JsonHelper.DeserializeObject<List<readingComprehensioItem>>(qItem.QuestionContent); List<readingComprehensioItem> readingList = JsonHelper.DeserializeObject<List<readingComprehensioItem>>(qItem.QuestionContent);
decimal tempRScore = 0; decimal tempRScore = 0;
...@@ -595,6 +597,11 @@ namespace Edu.Module.Exam ...@@ -595,6 +597,11 @@ namespace Edu.Module.Exam
} }
detailsModel.QuestionContent = JsonHelper.Serialize(readingList); detailsModel.QuestionContent = JsonHelper.Serialize(readingList);
} }
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "SetPaperTemplateModule_" + JsonHelper.Serialize(detailsModel));
}
}
string msg = analysisQuestion.CheckQuestion(detailsModel.QuestionTypeKey, detailsModel.QuestionContent, detailsModel.Answer, out string newAnswer, IsRequire: false); string msg = analysisQuestion.CheckQuestion(detailsModel.QuestionTypeKey, detailsModel.QuestionContent, detailsModel.Answer, out string newAnswer, IsRequire: false);
if (!string.IsNullOrEmpty(newAnswer)) if (!string.IsNullOrEmpty(newAnswer))
{ {
...@@ -604,6 +611,7 @@ namespace Edu.Module.Exam ...@@ -604,6 +611,7 @@ namespace Edu.Module.Exam
var newDetailsId = examination_DetailsRepository.Insert(detailsModel); var newDetailsId = examination_DetailsRepository.Insert(detailsModel);
detailsModel.Id = newDetailsId; detailsModel.Id = newDetailsId;
flag = newDetailsId > 0; flag = newDetailsId > 0;
} }
} }
} }
...@@ -767,7 +775,7 @@ namespace Edu.Module.Exam ...@@ -767,7 +775,7 @@ namespace Edu.Module.Exam
//完型填空 //完型填空
if (sItem.QuestionTypeKey == "cloze") if (sItem.QuestionTypeKey == "cloze")
{ {
if (!string.IsNullOrEmpty(sItem.Answer.ToString())) if (sItem.Answer != null && !string.IsNullOrEmpty(sItem.Answer.ToString()))
{ {
try try
{ {
...@@ -788,7 +796,7 @@ namespace Edu.Module.Exam ...@@ -788,7 +796,7 @@ namespace Edu.Module.Exam
} }
else if (sItem.QuestionTypeKey == "reading-comprehensio" || sItem.QuestionTypeKey == "listening") else if (sItem.QuestionTypeKey == "reading-comprehensio" || sItem.QuestionTypeKey == "listening")
{ {
if (!string.IsNullOrEmpty(sItem.Answer.ToString())) if (sItem.Answer != null && !string.IsNullOrEmpty(sItem.Answer.ToString()))
{ {
try try
{ {
...@@ -809,7 +817,15 @@ namespace Edu.Module.Exam ...@@ -809,7 +817,15 @@ namespace Edu.Module.Exam
} }
sItem.QuestionAnswerList = quesAnswerList; sItem.QuestionAnswerList = quesAnswerList;
sItem.QuestionPointList = pointList?.Where(qitem => sItem.Knowledge.Contains(qitem.PointId.ToString()))?.ToList() ?? new List<RB_Question_Point_ViewModel>(); sItem.QuestionPointList = pointList?.Where(qitem => sItem.Knowledge.Contains(qitem.PointId.ToString()))?.ToList() ?? new List<RB_Question_Point_ViewModel>();
try
{
sItem.QuestionContentObj = analysisQuestion.ParsingQuestion(sItem.QuestionTypeKey, sItem.QuestionContent); sItem.QuestionContentObj = analysisQuestion.ParsingQuestion(sItem.QuestionTypeKey, sItem.QuestionContent);
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "GetExaminationPaperModule— " + Common.Plugin.JsonHelper.Serialize(sItem));
}
string newTitle = sItem.Title; string newTitle = sItem.Title;
try try
{ {
......
...@@ -185,9 +185,10 @@ namespace Edu.Module.Question ...@@ -185,9 +185,10 @@ namespace Edu.Module.Question
/// <param name="isOptionRandom"></param> /// <param name="isOptionRandom"></param>
/// <param name="isNoAnswer"></param> /// <param name="isNoAnswer"></param>
/// <returns></returns> /// <returns></returns>
private object GetChooseOptionList(string data,int isOptionRandom,bool isNoAnswer,bool isSingleNum=false,bool isEdit=false) private object GetChooseOptionList(string data, int isOptionRandom, bool isNoAnswer, bool isSingleNum = false, bool isEdit = false)
{ {
var obj = new object(); var obj = new object();
var singleList = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(data); var singleList = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(data);
var newList = new List<optionItem>(); var newList = new List<optionItem>();
if (!isEdit) if (!isEdit)
...@@ -209,7 +210,7 @@ namespace Edu.Module.Question ...@@ -209,7 +210,7 @@ namespace Edu.Module.Question
Content = tempList[i].Content, Content = tempList[i].Content,
IsAnswer = tempList[i].IsAnswer IsAnswer = tempList[i].IsAnswer
}; };
item.ShowName = isSingleNum? (i + 1).ToString() : LetterArray[i]; item.ShowName = isSingleNum ? (i + 1).ToString() : LetterArray[i];
newList.Add(item); newList.Add(item);
} }
} }
...@@ -233,6 +234,7 @@ namespace Edu.Module.Question ...@@ -233,6 +234,7 @@ namespace Edu.Module.Question
{ {
obj = singleList; obj = singleList;
} }
return obj; return obj;
} }
...@@ -410,7 +412,18 @@ namespace Edu.Module.Question ...@@ -410,7 +412,18 @@ namespace Edu.Module.Question
//单选、多选、单选(数字)题 //单选、多选、单选(数字)题
if (QuestionTypeKey == "single" || QuestionTypeKey == "multiple" || QuestionTypeKey == "single-number") if (QuestionTypeKey == "single" || QuestionTypeKey == "multiple" || QuestionTypeKey == "single-number")
{ {
var optionItems = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(QuestionContent); if (!string.IsNullOrEmpty(QuestionContent))
{
var optionItems = new List<optionItem>();
try
{
optionItems = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(QuestionContent);
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, " CheckQuestion:____" + QuestionContent);
}
message = CheckChoose(optionItems); message = CheckChoose(optionItems);
var tempList = optionItems.Where(qitem => qitem.IsAnswer == true); var tempList = optionItems.Where(qitem => qitem.IsAnswer == true);
if (tempList != null && tempList.Count() > 0) if (tempList != null && tempList.Count() > 0)
...@@ -426,6 +439,7 @@ namespace Edu.Module.Question ...@@ -426,6 +439,7 @@ namespace Edu.Module.Question
return message; return message;
} }
} }
}
//判断题 //判断题
else if (QuestionTypeKey == "judge") else if (QuestionTypeKey == "judge")
{ {
......
...@@ -62,9 +62,9 @@ WHERE 1=1 AND B.Status=0 ...@@ -62,9 +62,9 @@ WHERE 1=1 AND B.Status=0
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@"
SELECT QuestionTypeId,DifficultyType,Category,Count(QuestionId) AS QuestionCount SELECT A.QuestionTypeId, A.DifficultyType,A.Category,Count(A.QuestionId) AS QuestionCount
FROM RB_Question FROM RB_Question AS A INNER JOIN rb_question_bank AS B ON A.BankId=B.BankId
WHERE 1=1 AND `Status`=0 WHERE 1=1 AND B.Status=0 AND A.Status=0
"); ");
if (query == null) if (query == null)
{ {
...@@ -74,17 +74,17 @@ WHERE 1=1 AND `Status`=0 ...@@ -74,17 +74,17 @@ WHERE 1=1 AND `Status`=0
{ {
if (!string.IsNullOrEmpty(query.QBankIds)) if (!string.IsNullOrEmpty(query.QBankIds))
{ {
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Question_ViewModel.BankId), query.QBankIds); builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Question_ViewModel.BankId), query.QBankIds);
} }
if (query.CourseId > 0) if (query.CourseId > 0)
{ {
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Question_ViewModel.CourseId), query.CourseId); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Question_ViewModel.CourseId), query.CourseId);
} }
if (!string.IsNullOrEmpty(query.Q_QuestionTypeIds)) if (!string.IsNullOrEmpty(query.Q_QuestionTypeIds))
{ {
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Question_ViewModel.QuestionTypeId), query.Q_QuestionTypeIds); builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Question_ViewModel.QuestionTypeId), query.Q_QuestionTypeIds);
} }
builder.AppendFormat(" GROUP BY QuestionTypeId,DifficultyType,Category "); builder.AppendFormat(" GROUP BY A.QuestionTypeId,A.DifficultyType,A.Category ");
return Get<RB_Question_ViewModel>(builder.ToString()).ToList(); return Get<RB_Question_ViewModel>(builder.ToString()).ToList();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment