From 0aac9cb8fca4674b9c388b551b0f2f95ef5c8c4a Mon Sep 17 00:00:00 2001 From: 10191 <506754232@qq.com> Date: Wed, 15 May 2024 09:35:01 +0800 Subject: [PATCH] 11 --- .../Controllers/HSSE/TestRecordController.cs | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs b/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs index 3889d56b..372313ac 100644 --- a/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs +++ b/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs @@ -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 }; } } }