diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs index b54802df..7da62d68 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs @@ -907,9 +907,11 @@ public class Ghre_ExamRecordServices : BaseServices new { it.IsPass }, true)//true表示追加AOP赋值列 .ExecuteCommandAsync(); + await Db.Deleteable().Where(x => x.ExamId == studyRecord.ExamId).ExecuteCommandAsync(); + if (record.IsPass == true) { - if (studyRecord.CourseSceneId.IsNull() && !await Db.Queryable().AnyAsync(x => x.ExamId == studyRecord.ExamId)) + if (studyRecord.CourseSceneId.IsNull()) { var course = await Db.Queryable().FirstAsync(x => x.Id == studyRecord.CourseId); #region 学分发放 @@ -930,6 +932,30 @@ public class Ghre_ExamRecordServices : BaseServices().Where(x => x.CourseSceneId == studyRecord.CourseSceneId).ToListAsync(); + + for (int i = 0; i < courses.Count; i++) + { + var snap = await Db.Queryable().FirstAsync(x => x.CourseId == courses[i].Id); + + #region 学分发放 + var creditPoint = new Ghre_CreditPoint() + { + CourseId = courses[i].Id, + CourseSnapId = snap?.Id, + StaffId = studyRecord.StaffId, + ExamId = studyRecord.ExamId, + Date = DateTime.Now.Date, + CreditPoints = courses[i].CreditPoints + }; + + await Db.Insertable(creditPoint).ExecuteReturnSnowflakeIdListAsync(); + #endregion + } + + } }