查询考试结果,新增餐宿判断,考完,是否允许查看答案和解析、考完,查看答案和解析后,是否允许重新考试

master
xiaochanghai 4 months ago
parent 2b23cd01f1
commit 9ecf34048b
  1. 28
      Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs

@ -2,7 +2,6 @@
using MongoDB.Driver.Linq; using MongoDB.Driver.Linq;
using System.Net; using System.Net;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Tiobon.Core.Model.Models;
using static Tiobon.Core.Model.Consts; using static Tiobon.Core.Model.Consts;
namespace Tiobon.Core.Services; namespace Tiobon.Core.Services;
@ -811,6 +810,26 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
extend.IsMissExam = true; extend.IsMissExam = true;
} }
#region 根据参数判断 考完,是否允许查看答案和解析、考完,查看答案和解析后,是否允许重新考试
if (record.Status == DIC_EXAM_RECORD_STATUS.EXAM_END &&
await Db.Queryable<Ghre_Config>().Where(x => x.ConfigCode == "After_Exam_Allow_View_Result").AnyAsync() &&
await Db.Queryable<Ghre_Config>().Where(x => x.ConfigCode == "After_Exam_View_Result_Allow_Retake").AnyAsync())
{
var allowViewResult = await Db.Queryable<Ghre_Config>().Where(x => x.ConfigCode == "After_Exam_Allow_View_Result").Select(x => x.ConfigValue).FirstAsync();
var allowRetake = await Db.Queryable<Ghre_Config>().Where(x => x.ConfigCode == "After_Exam_View_Result_Allow_Retake").Select(x => x.ConfigValue).FirstAsync();
if (allowViewResult == "Y")
{
if (allowRetake == "Y" && (record.RetakeTimes ?? 0) < (exampaper.RetakeTimes ?? 0))
extend.CanRetake = true;
else
extend.CanRetake = false;
}
else
extend.IsAllowView = false;
}
#endregion
return ServiceResult<QueryExam>.OprateSuccess("查询成功!", extend); return ServiceResult<QueryExam>.OprateSuccess("查询成功!", extend);
} }
@ -897,10 +916,10 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
var exam = await Db.Queryable<Ghre_Exam>() var exam = await Db.Queryable<Ghre_Exam>()
.Where(x => x.Id == record.ExamId) .Where(x => x.Id == record.ExamId)
.FirstAsync(x => x.Status == Consts.DIC_EXAM_STATUS.RELEASED); .FirstAsync(x => x.Status == DIC_EXAM_STATUS.RELEASED);
var studyRecord = await Db.Queryable<Ghre_StudyRecord>().FirstAsync(x => x.Id == record.StudyRecordId); var studyRecord = await Db.Queryable<Ghre_StudyRecord>().FirstAsync(x => x.Id == record.StudyRecordId);
if (exam.DateType == Consts.DicExamDateType.AFTER_HOW_LONG) if (exam.DateType == DicExamDateType.AFTER_HOW_LONG)
{ {
record.BeginTime = studyRecord?.EndTime; record.BeginTime = studyRecord?.EndTime;
if (!record.BeginTime.IsNull()) if (!record.BeginTime.IsNull())
@ -1039,6 +1058,7 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
record.Status = DIC_EXAM_RECORD_STATUS.EXAM_END; record.Status = DIC_EXAM_RECORD_STATUS.EXAM_END;
record.ActualEndTime = DateTime.Now; record.ActualEndTime = DateTime.Now;
record.ExamDate = DateTime.Now.Date;
var lastScore = record.Score; var lastScore = record.Score;
#region 打分-系统评分 #region 打分-系统评分
@ -1073,7 +1093,7 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
#endregion #endregion
record.UpdateTime = DateTime.Now; record.UpdateTime = DateTime.Now;
await Update(record, new List<string> { "Status", "Score", "AdjustScore", "ActualEndTime", "ScoreStatus", "UpdateTime" }, null, $"Id='{record.Id}'"); await Update(record, new List<string> { "Status", "Score", "AdjustScore", "ActualEndTime", "ScoreStatus", "UpdateTime", "ExamDate" }, null, $"Id='{record.Id}'");
if (exampaper.ScoreMethod == DIC_EXAM_PAPER_SCORE_METHOD.SYSTEM) if (exampaper.ScoreMethod == DIC_EXAM_PAPER_SCORE_METHOD.SYSTEM)
await Task.Factory.StartNew(async () => await DealPass(Db, studyRecordId)); await Task.Factory.StartNew(async () => await DealPass(Db, studyRecordId));

Loading…
Cancel
Save