Commit 4e220fb6 authored by 黄奎's avatar 黄奎

页面修改

parent f3a5ef11
......@@ -700,7 +700,7 @@ namespace Edu.Module.Exam
readingFinishCount = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ReadingChoose)?.Count() ?? 0;
listeningFinishCount = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.Listening)?.Count() ?? 0;
grammarFinishCount = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseGrammarUse)?.Count() ?? 0;
wordsTotalCount = finishList?.Where(qitem =>
wordsFinishCount = finishList?.Where(qitem =>
qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseWord
|| qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseMean
|| qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseWordUse
......@@ -749,7 +749,6 @@ namespace Edu.Module.Exam
foreach (var item in dataList)
{
var QuestionContentObj = analysisQuestion.ParsingQuestion(item.QuestionTypeKey, item.QuestionContent);
List<object> answerList = new List<object>();
List<object> quesAnswerList = new List<object>();
//填空题、分录题、资料题
if (item.QuestionTypeKey == "fill-in" || item.QuestionTypeKey == "entry-problem" || item.QuestionTypeKey == "data-question")
......@@ -759,7 +758,7 @@ namespace Edu.Module.Exam
{
foreach (var tItem in tempList)
{
answerList.Add(tItem);
quesAnswerList.Add(tItem);
}
}
}
......@@ -768,18 +767,25 @@ namespace Edu.Module.Exam
{
if (!string.IsNullOrEmpty(item.Answer.ToString()))
{
var qAnsList = Common.Plugin.JsonHelper.DeserializeObject<List<SubAnswerItem>>(item.Answer.ToString());
if (qAnsList != null && qAnsList.Count() > 0)
try
{
foreach (var tItem in qAnsList)
var qAnsList = Common.Plugin.JsonHelper.DeserializeObject<List<SubAnswerItem>>(item.Answer.ToString());
if (qAnsList != null && qAnsList.Count() > 0)
{
quesAnswerList.Add(tItem);
foreach (var tItem in qAnsList)
{
quesAnswerList.Add(tItem);
}
}
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "GetAppQuestionCategoryListModule_Cloze:" + Common.Plugin.JsonHelper.Serialize(item));
}
}
}
else if (item.QuestionTypeKey == "reading-comprehensio" || item.QuestionTypeKey == "listening")
else
{
if (!string.IsNullOrEmpty(item.Answer.ToString()))
{
......@@ -800,18 +806,20 @@ namespace Edu.Module.Exam
}
}
}
var obj = new
{
item.QuestionId,
item.QuestionTypeId,
item.QuestionTypeKey,
item.Category,
LevelType=item.BankType,
item.Title,
item.DifficultyType,
item.DifficultyTypeStr,
item.AnswerParse,
QuestionContentObj,
QuestionAnswerList = quesAnswerList,
AnswerList = answerList,
};
list.Add(obj);
}
......@@ -845,11 +853,12 @@ namespace Edu.Module.Exam
}
foreach (var item in bankList)
{
var tempList = stuExamList?.Where(qitem => qitem.BankId == item.BankId)?.ToList();
string LeastTime = "";
decimal HighestScore = 0;
string MyUseTime = "";
decimal MyScore = 0;
var tempList = stuExamList?.Where(qitem => qitem.BankId == item.BankId)?.OrderByDescending(qitem=>qitem.Score)?.ToList();
string LeastTime = "";//最短时间
decimal HighestScore = 0;//最高分
string MyUseTime = "";//用时
decimal MyScore = 0;//得分
int MyRank = 0;//排名
if (tempList != null)
{
var least = tempList?.OrderBy(qitem => qitem.ExamMinutes)?.FirstOrDefault();
......@@ -860,6 +869,7 @@ namespace Edu.Module.Exam
{
MyUseTime = Common.ConvertHelper.CalcMinutesAndSeconds(myLast.StartTime, myLast.EndTime);
MyScore = myLast.Score;
MyRank = tempList?.FindIndex(qitem => qitem.StudentId == query.StudentId) ?? 0;
}
}
var obj = new
......@@ -871,7 +881,7 @@ namespace Edu.Module.Exam
HighestScore,
MyUseTime,
MyScore,
MyRank = new Random().Next(1, 10),
MyRank,
};
result.Add(obj);
}
......@@ -984,6 +994,12 @@ namespace Edu.Module.Exam
public bool SetStudentPracticeModule(RB_Student_Practice_Extend model)
{
bool flag = false;
var oldModel = student_PracticeRepository.GetStudentPracticeListRepository(new RB_Student_Practice_Extend()
{
StudentId = model.StudentId,
QuestionId = model.QuestionId
})?.FirstOrDefault();
model.Id = oldModel?.Id ?? 0;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
......@@ -1024,7 +1040,14 @@ namespace Edu.Module.Exam
model.Id = newId;
flag = newId > 0;
}
if (flag && model.ExamDetailsList != null && model.ExamDetailsList.Count > 0)
{
foreach (var item in model.ExamDetailsList)
{
item.ExamId = model.Id;
student_ExamDetailsRepository.Insert(item);
}
}
return flag;
}
#endregion
......
......@@ -39,6 +39,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Practice_Extend.LevelType), (int)query.LevelType);
}
if (query.QuestionId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Practice_Extend.QuestionId), query.QuestionId);
}
}
return Get<RB_Student_Practice_Extend>(builder.ToString()).ToList();
}
......
......@@ -147,7 +147,7 @@ WHERE 1=1 AND B.Status=0 AND A.Status=0
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,IFNULL(B.`Name` ,'') AS QuestionTypeName
SELECT A.*,IFNULL(B.`Name` ,'') AS QuestionTypeName,IFNULL(C.BankType,0) AS BankType
FROM RB_Question AS A LEFT JOIN RB_Question_Type B ON A.QuestionTypeId=B.QId
INNER JOIN rb_question_bank AS C ON A.BankId=C.BankId
WHERE 1=1
......
......@@ -1097,6 +1097,7 @@ namespace Edu.WebApi.Controllers.Exam
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowRepeat]
public ApiResult SetStudentPractice()
{
var model = new RB_Student_Practice_Extend()
......@@ -1118,5 +1119,29 @@ namespace Edu.WebApi.Controllers.Exam
bool flag = courseExamModule.SetStudentPracticeModule(model);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 新增修改学员考试
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowRepeat]
public ApiResult SetStudentExam()
{
var model = new RB_Student_Exam_Extend()
{
Id=base.ParmJObj.GetInt("Id"),
BankId=base.ParmJObj.GetInt("BankId"),
StudentId=base.ParmJObj.GetInt("StudentId"),
StartTime=base.ParmJObj.GetDateTime("StartTime"),
EndTime=base.ParmJObj.GetDateTime("EndTime"),
Score=base.ParmJObj.GetDecimal("Score"),
Times=base.ParmJObj.GetInt("Times"),
CreateTime=DateTime.Now,
GroupId=base.ParmJObj.GetInt("GroupId")
};
bool flag = courseExamModule.SetStudentExamModule(model);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
}
}
\ No newline at end of file
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