|
|
|
@ -243,7 +243,7 @@ public class Ghre_StudyRecordServices : BaseServices<Ghre_StudyRecord, Ghre_Stud |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
if (entity.ExamRecordId != null) |
|
|
|
|
{ |
|
|
|
|
{ |
|
|
|
|
var Groups = await Db.Queryable<Ghre_ExamRecordGroup>() |
|
|
|
|
.OrderByDescending(x => x.ExamTime) |
|
|
|
|
.Where(x => x.ExamRecordId == entity.ExamRecordId) |
|
|
|
@ -2277,15 +2277,18 @@ ORDER BY {filter.orderBy}"; |
|
|
|
|
} |
|
|
|
|
else if (record.CourseSceneId.IsNotEmptyOrNull()) |
|
|
|
|
{ |
|
|
|
|
creditRuleId = await Db.Queryable<Ghre_CourseScene>().Where(x => x.Id == record.CourseId).Select(x => x.CreditRuleId).FirstAsync(); |
|
|
|
|
|
|
|
|
|
creditRuleId = await Db.Queryable<Ghre_CourseScene>().Where(x => x.Id == record.CourseId) |
|
|
|
|
.Select(x => x.CreditRuleId).FirstAsync(); |
|
|
|
|
courseCreditPoints = await Db.Queryable<Ghre_Course>().Where(x => x.CourseSceneIds.Contains(record.CourseSceneId.ObjToString())) |
|
|
|
|
.SumAsync(x => x.CreditPoints); |
|
|
|
|
} |
|
|
|
|
if (courseCreditPoints <= 0) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
record.CreditPoints = 0; |
|
|
|
|
if (creditRuleId != null) |
|
|
|
|
{ |
|
|
|
|
var creditRule = await Db.Queryable<Ghre_CreditRule>().Where(x => x.Id == record.CourseId).Select(x => new |
|
|
|
|
var creditRule = await Db.Queryable<Ghre_CreditRule>().Where(x => x.Id == creditRuleId).Select(x => new |
|
|
|
|
{ |
|
|
|
|
x.RuleType, |
|
|
|
|
x.ScoreRange, |
|
|
|
@ -2328,16 +2331,16 @@ ORDER BY {filter.orderBy}"; |
|
|
|
|
|
|
|
|
|
if (exam != null) |
|
|
|
|
{ |
|
|
|
|
var examPaper = await Db.Queryable<Ghre_ExamPaper>().Where(x => x.Id == examRecord.ExamId).FirstAsync(); |
|
|
|
|
var examPaper = await Db.Queryable<Ghre_ExamPaper>().Where(x => x.Id == exam.ExamPaperId).FirstAsync(); |
|
|
|
|
if (examPaper != null) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
var percent = (examRecord.Score / examPaper.TotalScore) * 100; |
|
|
|
|
|
|
|
|
|
percent = scoreRanges.Where(x => x.StartScore > percent && x.EndScore <= percent).Select(x => x.Credit).FirstOrDefault(); |
|
|
|
|
percent = scoreRanges.Where(x => x.StartScore < percent && x.EndScore >= percent).Select(x => x.Credit).FirstOrDefault(); |
|
|
|
|
|
|
|
|
|
if (percent != null) |
|
|
|
|
creditPoint.CreditPoints = ((courseCreditPoints * percent) / 100).ObjToInt(); |
|
|
|
|
creditPoint.CreditPoints = ((courseCreditPoints * percent) / 100).ObjToDecimal(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -2346,16 +2349,18 @@ ORDER BY {filter.orderBy}"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (creditPoint.CreditPoints > 0) |
|
|
|
|
{ |
|
|
|
|
record.CreditPoints = creditPoint.CreditPoints; |
|
|
|
|
creditPoints.Add(creditPoint); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//record.cre |
|
|
|
|
record.IsIssueCredit = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
await Db.Insertable(creditPoints).ExecuteReturnSnowflakeIdListAsync(); |
|
|
|
|
await Db.Updateable(records) |
|
|
|
|
.UpdateColumns(it => new { it.IsIssueCredit }, true) |
|
|
|
|
.UpdateColumns(it => new { it.IsIssueCredit, it.CreditPoints }, true) |
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
return ServiceResult.OprateSuccess("发放成功!"); |
|
|
|
|
} |
|
|
|
|