This commit is contained in:
李超 2024-05-15 09:35:01 +08:00
parent 331172c12b
commit 0aac9cb8fc
1 changed files with 27 additions and 19 deletions

View File

@ -583,35 +583,43 @@ namespace WebAPI.Controllers
string returnTestRecordId = string.Empty;
////考试分数
decimal getTestScores = APITestRecordService.getSubmitTestRecord(getTestRecord);
////及格分数
int getPassScores = 80;
var testRule = db.Sys_TestRule.FirstOrDefault();
if (testRule != null)
{
getPassScores = testRule.PassingScore;
}
if (getTestScores <= getPassScores)
{
int testCount = db.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count();
if (testCount < 2)
if (!string.IsNullOrEmpty(getTestRecord.TestPlanId))
{ ////及格分数
int getPassScores = 80;
var testRule = db.Sys_TestRule.FirstOrDefault();
if (testRule != null)
{
////重新生成一条考试记录 以及考试试卷
returnTestRecordId = APITestRecordService.getResitTestRecord(getTestRecord);
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,您将进入补考。";
getPassScores = testRule.PassingScore;
}
if (getTestScores <= getPassScores)
{
int testCount = db.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count();
if (testCount < 2)
{
////重新生成一条考试记录 以及考试试卷
returnTestRecordId = APITestRecordService.getResitTestRecord(getTestRecord);
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,您将进入补考。";
}
else
{
APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。";
}
}
else
{
APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。";
}
responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。";
} responeData.data = new { getTestScores, getPassScores, returnTestRecordId };
}
else
{
APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。";
responeData.data = new { getTestScores };
}
responeData.data = new { getTestScores, getPassScores, returnTestRecordId };
}
}
}