Commit c984b64b authored by 黄奎's avatar 黄奎

页面修改

parent a310383b
......@@ -433,13 +433,13 @@ namespace Edu.Module.Exam
PaperType = 1,
ParentId = model.ParentId,
IsOpen = model.IsOpen,
GroupType=model.GroupType,
GroupType = model.GroupType,
};
newPaperId = examination_PaperRepository.Insert(paperModel);
paperModel.PaperId = newPaperId;
flag = newPaperId > 0;
}
if (model.TemplateNum > 0)
{
for (var i = 0; i < model.TemplateNum; i++)
......@@ -460,8 +460,8 @@ namespace Edu.Module.Exam
PaperType = 2,
ParentId = newPaperId,
IsOpen = model.IsOpen,
GroupType=model.GroupType,
PaperScore=model.TemplateScore,
GroupType = model.GroupType,
PaperScore = model.TemplateScore,
};
var newSubPaperId = examination_PaperRepository.Insert(subModel);
subModel.PaperId = newSubPaperId;
......@@ -504,9 +504,9 @@ namespace Edu.Module.Exam
PaperId = subModel.PaperId,
GroupName = !string.IsNullOrEmpty(item.QuestionDesc) ? item.QuestionDesc : item.QuestionTypeName,
GSortNum = G_Sort,
GScore=item.QuestionScore,
GScore = item.QuestionScore,
QuestionTypeKey = item.QuestionTypeKey,
GroupType=model.GroupType,
GroupType = model.GroupType,
};
if (model.GroupType == ExamGroupTypeEnum.QuestionType)
{
......@@ -528,7 +528,7 @@ namespace Edu.Module.Exam
var detailsModel = new RB_Examination_Details_ViewModel()
{
Id = 0,
GId= groupModel.GId,
GId = groupModel.GId,
PaperId = subModel.PaperId,
BankId = qItem.BankId,
QuestionId = qItem.QuestionId,
......@@ -576,24 +576,31 @@ namespace Edu.Module.Exam
}
else if (qItem.QuestionTypeKey == "listening" || qItem.QuestionTypeKey == "reading-comprehensio")
{
List<readingComprehensioItem> readingList = JsonHelper.DeserializeObject<List<readingComprehensioItem>>(qItem.QuestionContent);
decimal tempRScore = 0;
int rIndex = 0;
var rScore = Math.Floor(detailsModel.Score / readingList.Count * 100) / 100;
foreach (var rItem in readingList)
try
{
if (rIndex != readingList.Count - 1)
List<readingComprehensioItem> readingList = JsonHelper.DeserializeObject<List<readingComprehensioItem>>(qItem.QuestionContent);
decimal tempRScore = 0;
int rIndex = 0;
var rScore = Math.Floor(detailsModel.Score / readingList.Count * 100) / 100;
foreach (var rItem in readingList)
{
tempRScore += rScore;
rItem.SubScore = rScore;
}
else
{
rItem.SubScore = detailsModel.Score - tempRScore;
if (rIndex != readingList.Count - 1)
{
tempRScore += rScore;
rItem.SubScore = rScore;
}
else
{
rItem.SubScore = detailsModel.Score - tempRScore;
}
rIndex++;
}
rIndex++;
detailsModel.QuestionContent = JsonHelper.Serialize(readingList);
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "SetPaperTemplateModule_" + JsonHelper.Serialize(detailsModel));
}
detailsModel.QuestionContent = JsonHelper.Serialize(readingList);
}
string msg = analysisQuestion.CheckQuestion(detailsModel.QuestionTypeKey, detailsModel.QuestionContent, detailsModel.Answer, out string newAnswer, IsRequire: false);
if (!string.IsNullOrEmpty(newAnswer))
......@@ -604,6 +611,7 @@ namespace Edu.Module.Exam
var newDetailsId = examination_DetailsRepository.Insert(detailsModel);
detailsModel.Id = newDetailsId;
flag = newDetailsId > 0;
}
}
}
......@@ -767,7 +775,7 @@ namespace Edu.Module.Exam
//完型填空
if (sItem.QuestionTypeKey == "cloze")
{
if (!string.IsNullOrEmpty(sItem.Answer.ToString()))
if (sItem.Answer != null && !string.IsNullOrEmpty(sItem.Answer.ToString()))
{
try
{
......@@ -788,7 +796,7 @@ namespace Edu.Module.Exam
}
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
{
......@@ -809,7 +817,15 @@ namespace Edu.Module.Exam
}
sItem.QuestionAnswerList = quesAnswerList;
sItem.QuestionPointList = pointList?.Where(qitem => sItem.Knowledge.Contains(qitem.PointId.ToString()))?.ToList() ?? new List<RB_Question_Point_ViewModel>();
sItem.QuestionContentObj = analysisQuestion.ParsingQuestion(sItem.QuestionTypeKey, sItem.QuestionContent);
try
{
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;
try
{
......
......@@ -185,54 +185,56 @@ namespace Edu.Module.Question
/// <param name="isOptionRandom"></param>
/// <param name="isNoAnswer"></param>
/// <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 singleList = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(data);
var newList = new List<optionItem>();
if (!isEdit)
{
singleList.ForEach(item =>
var singleList = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(data);
var newList = new List<optionItem>();
if (!isEdit)
{
item.ShowName = item.Name;
});
}
//选项随机
if (isOptionRandom == 1)
{
var tempList = singleList.OrderBy(qitem => Guid.NewGuid()).ToList();
for (var i = 0; i < tempList.Count; i++)
singleList.ForEach(item =>
{
item.ShowName = item.Name;
});
}
//选项随机
if (isOptionRandom == 1)
{
var item = new optionItem()
var tempList = singleList.OrderBy(qitem => Guid.NewGuid()).ToList();
for (var i = 0; i < tempList.Count; i++)
{
Name = tempList[i].Name,
Content = tempList[i].Content,
IsAnswer = tempList[i].IsAnswer
};
item.ShowName = isSingleNum? (i + 1).ToString() : LetterArray[i];
newList.Add(item);
var item = new optionItem()
{
Name = tempList[i].Name,
Content = tempList[i].Content,
IsAnswer = tempList[i].IsAnswer
};
item.ShowName = isSingleNum ? (i + 1).ToString() : LetterArray[i];
newList.Add(item);
}
}
}
//去掉答案
if (isNoAnswer)
{
singleList.ForEach(item =>
//去掉答案
if (isNoAnswer)
{
item.IsAnswer = false;
});
newList.ForEach(item =>
singleList.ForEach(item =>
{
item.IsAnswer = false;
});
newList.ForEach(item =>
{
item.IsAnswer = false;
});
}
if (isOptionRandom == 1)
{
item.IsAnswer = false;
});
}
if (isOptionRandom == 1)
{
obj = newList;
}
else
{
obj = singleList;
}
obj = newList;
}
else
{
obj = singleList;
}
return obj;
}
......@@ -410,20 +412,32 @@ namespace Edu.Module.Question
//单选、多选、单选(数字)题
if (QuestionTypeKey == "single" || QuestionTypeKey == "multiple" || QuestionTypeKey == "single-number")
{
var optionItems = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(QuestionContent);
message = CheckChoose(optionItems);
var tempList = optionItems.Where(qitem => qitem.IsAnswer == true);
if (tempList != null && tempList.Count() > 0)
{
AnalysisAnswer = string.Join(",", tempList.OrderBy(qitem => qitem.Name).Select(qitem => qitem.Name));
}
else
if (!string.IsNullOrEmpty(QuestionContent))
{
AnalysisAnswer = "";
}
if (!string.IsNullOrEmpty(message))
{
return message;
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);
var tempList = optionItems.Where(qitem => qitem.IsAnswer == true);
if (tempList != null && tempList.Count() > 0)
{
AnalysisAnswer = string.Join(",", tempList.OrderBy(qitem => qitem.Name).Select(qitem => qitem.Name));
}
else
{
AnalysisAnswer = "";
}
if (!string.IsNullOrEmpty(message))
{
return message;
}
}
}
//判断题
......
......@@ -62,9 +62,9 @@ WHERE 1=1 AND B.Status=0
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT QuestionTypeId,DifficultyType,Category,Count(QuestionId) AS QuestionCount
FROM RB_Question
WHERE 1=1 AND `Status`=0
SELECT A.QuestionTypeId, A.DifficultyType,A.Category,Count(A.QuestionId) AS QuestionCount
FROM RB_Question AS A INNER JOIN rb_question_bank AS B ON A.BankId=B.BankId
WHERE 1=1 AND B.Status=0 AND A.Status=0
");
if (query == null)
{
......@@ -74,17 +74,17 @@ WHERE 1=1 AND `Status`=0
{
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)
{
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))
{
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();
}
}
......
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