Commit 26aebfb7 authored by 黄奎's avatar 黄奎

题库答案处理

parent f6814fb3
......@@ -770,7 +770,26 @@ namespace Edu.Module.Exam
{
var QuestionContentObj = analysisQuestion.ParsingQuestion(item.QuestionTypeKey, item.QuestionContent);
List<object> quesAnswerList = new List<object>();
if (!string.IsNullOrEmpty(item.Answer.ToString()))
if (item.QuestionTypeKey == "listening" || item.QuestionTypeKey == "reading-comprehensio")
{
try
{
var listenList = JsonHelper.DeserializeObject<List<SubAnswerItem>>(item.Answer);
if (listenList != null && listenList.Count > 0)
{
foreach (var subItem in listenList)
{
quesAnswerList.Add(subItem.SubAnswer);
}
}
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "GetAppQuestionCategoryListModule_listening:" + Common.Plugin.JsonHelper.Serialize(item));
}
}
if (item.QuestionTypeKey != "listening" && item.QuestionTypeKey != "reading-comprehensio" && !string.IsNullOrEmpty(item.Answer.ToString()))
{
try
{
......@@ -891,15 +910,32 @@ namespace Edu.Module.Exam
{
var QuestionContentObj = analysisQuestion.ParsingQuestion(item.QuestionTypeKey, item.QuestionContent, isNoAnswer: true);
List<object> quesAnswerList = new List<object>();
if (!string.IsNullOrEmpty(item.Answer.ToString()))
if (item.QuestionTypeKey == "listening" || item.QuestionTypeKey == "reading-comprehensio")
{
try
{
var listenList = JsonHelper.DeserializeObject<List<SubAnswerItem>>(item.Answer);
if (listenList != null && listenList.Count > 0)
{
foreach (var subItem in listenList)
{
quesAnswerList.Add(subItem.SubAnswer);
}
}
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "GetAppQuestionCategoryListModule_listening:" + Common.Plugin.JsonHelper.Serialize(item));
}
}
if (item.QuestionTypeKey != "listening" && item.QuestionTypeKey != "reading-comprehensio" && !string.IsNullOrEmpty(item.Answer.ToString()))
{
try
{
var qAnsList = Common.ConvertHelper.StringToFileList(item.Answer.ToString());
if (qAnsList != null && qAnsList.Count() > 0)
var tempList = Common.ConvertHelper.StringToFileList(item.Answer);
if (tempList != null && tempList.Count > 0)
{
foreach (var tItem in qAnsList)
foreach (var tItem in tempList)
{
quesAnswerList.Add(tItem);
}
......@@ -907,7 +943,7 @@ namespace Edu.Module.Exam
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "GetAppBankDetailsPageModule_Answer:" + Common.Plugin.JsonHelper.Serialize(item));
Common.Plugin.LogHelper.Write(ex, "GetAppQuestionCategoryListModule_Answer:" + Common.Plugin.JsonHelper.Serialize(item));
}
}
var obj = new
......
......@@ -14,6 +14,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Edu.WebApi.Controllers.Course
{
......@@ -402,6 +403,38 @@ namespace Edu.WebApi.Controllers.Course
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 重新修改问题答案
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult RunQuestion()
{
Task.Run(() => {
var list = questionModule.GetQuestionListModule(new RB_Question_ViewModel() { Q_QuestionTypeIds = "14,16", });
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
try
{
var listenList = JsonHelper.DeserializeObject<List<SubAnswerItem>>(item.Answer);
}
catch
{
string str = analysisQuestion.CheckQuestion(item.QuestionTypeKey, item.QuestionContent, item.Answer, out string newAnswer, IsRequire: false);
if (!string.IsNullOrEmpty(newAnswer))
{
item.Answer = newAnswer;
bool flag = questionModule.SetQuestionModule(item);
}
}
}
}
});
return ApiResult.Success();
}
/// <summary>
/// 批量修改问题考级程度
/// </summary>
......
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