Commit 2ca30ba5 authored by 黄奎's avatar 黄奎

页面修改

parent c992b43e
...@@ -41,6 +41,11 @@ namespace Edu.Model.ViewModel.Exam ...@@ -41,6 +41,11 @@ namespace Edu.Model.ViewModel.Exam
/// </summary> /// </summary>
public decimal StudentScore { get; set; } public decimal StudentScore { get; set; }
/// <summary>
/// 听力、阅读理解、完型填空、子项列表
/// </summary>
public List<SubAnswerItem> SubList { get; set; }
/// <summary> /// <summary>
/// 学生答案详情id(关联RB_Examination_StudentDetails表中的Id) /// 学生答案详情id(关联RB_Examination_StudentDetails表中的Id)
/// </summary> /// </summary>
......
...@@ -1540,8 +1540,18 @@ namespace Edu.Module.Exam ...@@ -1540,8 +1540,18 @@ namespace Edu.Module.Exam
{ {
decimal totalScore = 0; decimal totalScore = 0;
foreach (var item in list) foreach (var item in list)
{
decimal tempScore = item.StudentScore;
if (item.SubList != null && item.SubList.Count > 0)
{
totalScore += item.SubList.Sum(qitem => qitem.StudentScore);
tempScore = item.SubList.Sum(qitem => qitem.StudentScore);
}
else
{ {
totalScore += item.StudentScore; totalScore += item.StudentScore;
}
RB_Examination_StudentDetails_ViewModel model = new RB_Examination_StudentDetails_ViewModel() RB_Examination_StudentDetails_ViewModel model = new RB_Examination_StudentDetails_ViewModel()
{ {
Id = item.StundetDetailsId, Id = item.StundetDetailsId,
...@@ -1551,9 +1561,13 @@ namespace Edu.Module.Exam ...@@ -1551,9 +1561,13 @@ namespace Edu.Module.Exam
{ {
Dictionary<string, object> stuFileds = new Dictionary<string, object>() Dictionary<string, object> stuFileds = new Dictionary<string, object>()
{ {
{nameof(RB_Examination_StudentDetails_ViewModel.StudentScore),model.StudentScore }, {nameof(RB_Examination_StudentDetails_ViewModel.StudentScore),tempScore },
{nameof(RB_Examination_StudentDetails_ViewModel.IsMarking),1 }, {nameof(RB_Examination_StudentDetails_ViewModel.IsMarking),1 },
}; };
if (item.SubList != null && item.SubList.Count > 0)
{
stuFileds.Add(nameof(RB_Examination_StudentDetails_ViewModel.StundetAnswer), Common.Plugin.JsonHelper.Serialize(item.SubList));
}
flag = examination_StudentDetailsRepository.Update(stuFileds, new WhereHelper(nameof(RB_Examination_StudentDetails_ViewModel.Id), model.Id)); flag = examination_StudentDetailsRepository.Update(stuFileds, new WhereHelper(nameof(RB_Examination_StudentDetails_ViewModel.Id), model.Id));
} }
} }
......
...@@ -6,6 +6,7 @@ using Edu.Common.Enum.Question; ...@@ -6,6 +6,7 @@ using Edu.Common.Enum.Question;
using Edu.Common.Plugin; using Edu.Common.Plugin;
using Edu.Model.ViewModel.Exam; using Edu.Model.ViewModel.Exam;
using Edu.Model.ViewModel.Flow; using Edu.Model.ViewModel.Flow;
using Edu.Model.ViewModel.Question;
using Edu.Module.Exam; using Edu.Module.Exam;
using Edu.Module.Question; using Edu.Module.Question;
using Edu.Module.System; using Edu.Module.System;
...@@ -854,11 +855,23 @@ namespace Edu.WebApi.Controllers.Exam ...@@ -854,11 +855,23 @@ namespace Edu.WebApi.Controllers.Exam
foreach (var sItem in subArray) foreach (var sItem in subArray)
{ {
JObject sObj = JObject.Parse(sItem.ToString()); JObject sObj = JObject.Parse(sItem.ToString());
var qKey = sObj.GetStringValue("QuestionTypeKey");
string answer= sObj.GetStringValue("AnswerList");
List<SubAnswerItem> subList = new List<SubAnswerItem>();
if (qKey == "reading-comprehensio" || qKey == "listening" || qKey == "cloze")
{
if (!string.IsNullOrEmpty(answer))
{
subList = Common.Plugin.JsonHelper.DeserializeObject<List<SubAnswerItem>>(answer);
}
}
var detailModel = new RB_Examination_Details_ViewModel() var detailModel = new RB_Examination_Details_ViewModel()
{ {
Id = sObj.GetInt("PaperDetailsId"), Id = sObj.GetInt("PaperDetailsId"),
StundetDetailsId = sObj.GetInt("StundetDetailsId"), StundetDetailsId = sObj.GetInt("StundetDetailsId"),
StudentScore = sObj.GetDecimal("StudentScore"), StudentScore = sObj.GetDecimal("StudentScore"),
SubList= subList,
}; };
paperDetailsList.Add(detailModel); paperDetailsList.Add(detailModel);
} }
......
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