|
|
|
@ -2255,6 +2255,7 @@ ORDER BY {filter.orderBy}"; |
|
|
|
|
{ |
|
|
|
|
var now = DateTime.Now; |
|
|
|
|
//抓取当天提交考试的数据 |
|
|
|
|
|
|
|
|
|
var records = await Db.Queryable<Ghre_StudyRecord>() |
|
|
|
|
.Where(x => x.StudyProgress == 100 && (x.IsIssueCredit == null || x.IsIssueCredit == false)) |
|
|
|
|
.Take(100) |
|
|
|
@ -2285,9 +2286,9 @@ ORDER BY {filter.orderBy}"; |
|
|
|
|
if (courseCreditPoints <= 0) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
record.CreditPoints = 0; |
|
|
|
|
if (creditRuleId != null) |
|
|
|
|
{ |
|
|
|
|
record.CreditPoints = 0; |
|
|
|
|
var creditRule = await Db.Queryable<Ghre_CreditRule>().Where(x => x.Id == creditRuleId).Select(x => new |
|
|
|
|
{ |
|
|
|
|
x.RuleType, |
|
|
|
@ -2314,8 +2315,9 @@ ORDER BY {filter.orderBy}"; |
|
|
|
|
{ |
|
|
|
|
if (record.ExamId != null) |
|
|
|
|
{ |
|
|
|
|
if (await Db.Queryable<Ghre_ExamRecord>().Where(x => x.StudyRecordId == record.Id && x.IsPass == true && x.Status == "ExamEnd").AnyAsync()) |
|
|
|
|
creditPoint.CreditPoints = ((courseCreditPoints * creditRule.ExamPassPercent) / 100).ObjToInt(); |
|
|
|
|
if (await Db.Queryable<Ghre_ExamRecord>().Where(x => x.StudyRecordId == record.Id && x.IsPass == true && x.Status == "ExamEnd").AnyAsync()) { } |
|
|
|
|
creditPoint.CreditPoints = ((courseCreditPoints * creditRule.ExamPassPercent) / 100).ObjToInt(); |
|
|
|
|
record.IsIssueCredit = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if (creditRule.RuleType == "ScoreRanges")//分数段 |
|
|
|
@ -2324,6 +2326,7 @@ ORDER BY {filter.orderBy}"; |
|
|
|
|
|
|
|
|
|
if (record.ExamId != null) |
|
|
|
|
{ |
|
|
|
|
record.IsIssueCredit = true; |
|
|
|
|
var examRecord = await Db.Queryable<Ghre_ExamRecord>().Where(x => x.StudyRecordId == record.Id && x.ScoreStatus == "HasScore" && x.IsPass == true && x.Status == "ExamEnd").FirstAsync(); |
|
|
|
|
if (examRecord != null && examRecord.Score > 0) |
|
|
|
|
{ |
|
|
|
@ -2355,12 +2358,13 @@ ORDER BY {filter.orderBy}"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
record.IsIssueCredit = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
await Db.Insertable(creditPoints).ExecuteReturnSnowflakeIdListAsync(); |
|
|
|
|
records = records.Where(x => x.IsIssueCredit == true).ToList(); |
|
|
|
|
await Db.Updateable(records) |
|
|
|
|
.UpdateColumns(it => new { it.IsIssueCredit, it.CreditPoints }, true) |
|
|
|
|
|
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
return ServiceResult.OprateSuccess("发放成功!"); |
|
|
|
|
} |
|
|
|
|