Commit ebdf85f6 authored by 黄奎's avatar 黄奎

页面修改

parent f9da4b98
......@@ -10,22 +10,34 @@ namespace Edu.Common.Enum.Exam
/// </summary>
public enum ExamTestStatusEnum
{
/// <summary>
/// 未开始
/// </summary>
[EnumField("未开始")]
NotStarted = 1,
/// <summary>
/// 已开始
/// </summary>
[EnumField("已开始")]
FinishStarted = 2,
/// <summary>
/// 已考试
/// </summary>
[EnumField("已考试")]
FinishTest = 1,
FinishTest = 3,
/// <summary>
/// 未考试
/// 缺考
/// </summary>
[EnumField("未考试")]
NotFinishTest = 2,
[EnumField("缺考")]
MissedTest = 4,
/// <summary>
/// 已阅卷
/// </summary>
[EnumField("已阅卷")]
FinishScoring = 3,
FinishScoring = 5,
}
}
......@@ -74,7 +74,7 @@ namespace Edu.Model.Entity.Exam
public int Status { get; set; }
/// <summary>
/// 考试状态,0-没考,1-已考
/// 考试状态(见枚举)
/// </summary>
public ExamTestStatusEnum ExamStatus { get; set; }
......
using Edu.Model.Entity.Exam;
using Edu.Common.Enum.Exam;
using Edu.Model.Entity.Exam;
using System;
using System.Collections.Generic;
using System.Text;
......@@ -46,9 +47,9 @@ namespace Edu.Model.ViewModel.Exam
public int GuestId { get; set; }
/// <summary>
/// 考试状态,0-没考,1-已考(查询条件的时候,1-未开始,2-已开始,3-已缺考,4-已完成)
/// 考试状态(见枚举)
/// </summary>
public int ExamStatus { get; set; }
public ExamTestStatusEnum ExamStatus { get; set; }
/// <summary>
/// 考试状态
......
......@@ -1062,7 +1062,7 @@ namespace Edu.Module.Exam
item.PaperId = model.PaperId;
item.Group_Id = model.Group_Id;
item.School_Id = model.School_Id;
item.ExamStatus = ExamTestStatusEnum.NotFinishTest;
item.ExamStatus = ExamTestStatusEnum.NotStarted;
examination_StudentRepository.Insert(item);
}
}
......@@ -1094,7 +1094,7 @@ namespace Edu.Module.Exam
if (dItem.Id == 0)
{
dItem.ExamStatus = ExamTestStatusEnum.NotFinishTest;
dItem.ExamStatus = ExamTestStatusEnum.NotStarted;
examination_StudentRepository.Insert(dItem);
}
else
......@@ -1307,6 +1307,7 @@ namespace Edu.Module.Exam
foreach (var sItem in stuTempList)
{
var questionModel = gItem?.DetailsList.Where(qitem => qitem.Id == sItem.DetailsId)?.FirstOrDefault();
ExamScore += questionModel.Score;
var QuestionContentObj = new object();
if (isShowAnswer)
{
......@@ -1416,6 +1417,7 @@ namespace Edu.Module.Exam
List<RB_Examination_StudentDetails_ViewModel> tempStudentList = new List<RB_Examination_StudentDetails_ViewModel>();
foreach (var sItem in tempDetailsList)
{
ExamScore += sItem.Score;
sItem.QuestionContentObj = analysisQuestion.ParsingQuestion(sItem.QuestionTypeKey, sItem.QuestionContent, isNoAnswer: true, isOptionRandom: examPublish.IsOptionRandom);
var qObj = new
{
......@@ -1438,8 +1440,6 @@ namespace Edu.Module.Exam
questionList.Add(qObj);
}
}
ExamScore += gItem.GScore;
paperTypeList.Add(new
{
gItem.GId,
......@@ -1463,40 +1463,25 @@ namespace Edu.Module.Exam
}
examPublish.GuestId = GuestId;
extModel.GuestId = GuestId;
int ExamStatusTemp = 0;//-1-缺考, 0-未开始,1-已开始,2-已考试,3-已阅卷
if (examPublish.ExamStartTime > System.DateTime.Now)
if (examinationStudentModel == null)
{
ExamStatusTemp = 0;
examinationStudentModel = new RB_Examination_Student_ViewModel
{
ExamStatus = ExamTestStatusEnum.NotStarted
};
}
else if (examPublish.ExamStartTime < System.DateTime.Now && examPublish.ExamEndTime > System.DateTime.Now)
if (examPublish.ExamStartTime < System.DateTime.Now && examPublish.ExamEndTime > System.DateTime.Now)
{
if (Convert.ToInt32(examinationStudentModel?.ExamStatus ?? ExamTestStatusEnum.NotFinishTest) == 2)
{
ExamStatusTemp = 1;
}
if (Convert.ToInt32(examinationStudentModel?.ExamStatus ?? ExamTestStatusEnum.NotFinishTest) == 1)
if (examinationStudentModel.ExamStatus != ExamTestStatusEnum.FinishTest && examinationStudentModel.ExamStatus != ExamTestStatusEnum.FinishScoring)
{
ExamStatusTemp = 2;
}
if (Convert.ToInt32(examinationStudentModel?.ExamStatus ?? ExamTestStatusEnum.NotFinishTest) == 3)
{
ExamStatusTemp = 3;
examinationStudentModel.ExamStatus = ExamTestStatusEnum.FinishStarted;
}
}
else if (examPublish.ExamEndTime < System.DateTime.Now)
{
if (Convert.ToInt32(examinationStudentModel?.ExamStatus ?? ExamTestStatusEnum.NotFinishTest) == 2)
{
ExamStatusTemp = -1;
}
else if (Convert.ToInt32(examinationStudentModel?.ExamStatus ?? ExamTestStatusEnum.NotFinishTest) == 1)
{
ExamStatusTemp = 2;
}
else if (Convert.ToInt32(examinationStudentModel?.ExamStatus ?? ExamTestStatusEnum.NotFinishTest) == 3)
if (examinationStudentModel.ExamStatus != ExamTestStatusEnum.FinishTest && examinationStudentModel.ExamStatus != ExamTestStatusEnum.FinishScoring)
{
ExamStatusTemp = 3;
examinationStudentModel.ExamStatus = ExamTestStatusEnum.MissedTest;
}
}
return new
......@@ -1524,7 +1509,7 @@ namespace Edu.Module.Exam
TotalScore = examinationStudentModel?.TotalScore ?? 0,
StuComment = examinationStudentModel?.StuComment ?? "",
ExamStatus = examinationStudentModel?.ExamStatus ?? 0,
ExamStatusTemp,
ExamStatusName = examinationStudentModel?.ExamStatus.ToName() ?? "",
Paper = paperObj
};
}
......
using Edu.Common.Enum;
using Edu.Common.Enum.Exam;
using Edu.Model.Entity.Exam;
using Edu.Model.ViewModel.Exam;
using System;
......@@ -131,21 +132,21 @@ WHERE 1=1 and a.ExamineStatus=2 and b.ExamineStatus=2
}
if (query.ExamStatus > 0)
{
if (query.ExamStatus == 1)
if (query.ExamStatus == ExamTestStatusEnum.NotStarted)
{
builder.AppendFormat(" AND a.{0} > '{1}' ", nameof(RB_Examination_Publish_ViewModel.ExamStartTime), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
}
else if (query.ExamStatus == 2)
else if (query.ExamStatus == ExamTestStatusEnum.FinishStarted)
{
builder.AppendFormat(" AND a.{0} < '{1}' and a.{2} > '{1}' and c.{3}=2 ", nameof(RB_Examination_Publish_ViewModel.ExamStartTime), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), nameof(RB_Examination_Publish_ViewModel.ExamEndTime), nameof(RB_Examination_Publish_ViewModel.ExamStatus));
builder.AppendFormat(" AND a.{0} < '{1}' and a.{2} > '{1}' and c.{3}=1 ", nameof(RB_Examination_Publish_ViewModel.ExamStartTime), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), nameof(RB_Examination_Publish_ViewModel.ExamEndTime), nameof(RB_Examination_Publish_ViewModel.ExamStatus));
}
else if (query.ExamStatus == 3)
else if (query.ExamStatus == ExamTestStatusEnum.MissedTest)
{
builder.AppendFormat(" AND a.{0} < '{1}' and c.{2}=2 ", nameof(RB_Examination_Publish_ViewModel.ExamEndTime), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), nameof(RB_Examination_Publish_ViewModel.ExamStatus));
builder.AppendFormat(" AND a.{0} < '{1}' and c.{2} NOT IN(3,5) ", nameof(RB_Examination_Publish_ViewModel.ExamEndTime), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), nameof(RB_Examination_Publish_ViewModel.ExamStatus));
}
else if (query.ExamStatus == 4)
else if (query.ExamStatus == ExamTestStatusEnum.FinishTest)
{
builder.AppendFormat(" AND (c.{0}=1 or c.{0}=3)", nameof(RB_Examination_Publish_ViewModel.ExamStatus));
builder.AppendFormat(" AND c.{0} IN(3,5)", nameof(RB_Examination_Publish_ViewModel.ExamStatus));
}
}
}
......
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Edu.Common.API;
using Edu.Common.Enum.Exam;
using Edu.Common.Enum.Question;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Exam;
......@@ -115,30 +116,23 @@ namespace Edu.WebApi.Controllers.Applet
{
if (item.ExamStartTime > System.DateTime.Now)
{
item.ExamStatusStr = "未开始";
item.ExamStatus = ExamTestStatusEnum.NotStarted;
}
else if (item.ExamStartTime < System.DateTime.Now && item.ExamEndTime > System.DateTime.Now)
{
if (item.ExamStatus == 2)
if (item.ExamStatus != ExamTestStatusEnum.FinishTest && item.ExamStatus != ExamTestStatusEnum.FinishScoring)
{
item.ExamStatusStr = "已开始";
}
if (item.ExamStatus == 1 || item.ExamStatus == 3)
{
item.ExamStatusStr = "完成";
item.ExamStatus = ExamTestStatusEnum.FinishStarted;
}
}
else if (item.ExamEndTime < System.DateTime.Now)
{
if (item.ExamStatus == 2)
{
item.ExamStatusStr = "缺考";
}
else if (item.ExamStatus == 1 || item.ExamStatus == 3)
if (item.ExamStatus != ExamTestStatusEnum.FinishTest && item.ExamStatus != ExamTestStatusEnum.FinishScoring)
{
item.ExamStatusStr = "完成";
item.ExamStatus = ExamTestStatusEnum.MissedTest;
}
}
item.ExamStatusStr = item.ExamStatus.ToName();
}
}
}
......@@ -518,7 +512,7 @@ namespace Edu.WebApi.Controllers.Applet
var query = new Model.ViewModel.Exam.RB_Examination_Publish_ViewModel()
{
Group_Id = base.AppletUserInfo.Group_Id,
ExamStatus = base.ParmJObj.GetInt("ExamStatus", 0),
ExamStatus = (ExamTestStatusEnum)base.ParmJObj.GetInt("ExamStatus", 0),
GuestId = base.ParmJObj.GetInt("GuestId", 0),
};
var list = paperModule.GetGuestExaminationPublishPage(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
......@@ -526,28 +520,20 @@ namespace Edu.WebApi.Controllers.Applet
{
if (item.ExamStartTime > System.DateTime.Now)
{
item.ExamStatusStr = "未开始";
item.ExamStatus = ExamTestStatusEnum.NotStarted;
}
else if (item.ExamStartTime < System.DateTime.Now && item.ExamEndTime > System.DateTime.Now)
{
if (item.ExamStatus == 2)
if (item.ExamStatus != ExamTestStatusEnum.FinishTest &&item.ExamStatus!= ExamTestStatusEnum.FinishScoring )
{
item.ExamStatusStr = "已开始";
}
if (item.ExamStatus == 1 || item.ExamStatus == 3)
{
item.ExamStatusStr = "完成";
item.ExamStatus = ExamTestStatusEnum.FinishStarted;
}
}
else if (item.ExamEndTime < System.DateTime.Now)
{
if (item.ExamStatus == 2)
{
item.ExamStatusStr = "缺考";
}
else if (item.ExamStatus == 1 || item.ExamStatus == 3)
if (item.ExamStatus != ExamTestStatusEnum.FinishTest && item.ExamStatus != ExamTestStatusEnum.FinishScoring)
{
item.ExamStatusStr = "完成";
item.ExamStatus = ExamTestStatusEnum.MissedTest;
}
}
}
......@@ -563,7 +549,7 @@ namespace Edu.WebApi.Controllers.Applet
ExamEndTime = Common.ConvertHelper.FormatTime(x.ExamEndTime),
x.ExamTimes,
x.ExamStatus,
x.ExamStatusStr
ExamStatusStr=x.ExamStatus.ToName()
});
pageModel.Count = rowsCount;
return ApiResult.Success(data: pageModel);
......
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