|
|
@ -219,7 +219,8 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
QuestionId = x.QuestionId.Value, |
|
|
|
QuestionId = x.QuestionId.Value, |
|
|
|
ExamPaperId = x.ExamPaperId, |
|
|
|
ExamPaperId = x.ExamPaperId, |
|
|
|
Score = x.Score, |
|
|
|
Score = x.Score, |
|
|
|
RealScore = details.Where(m => m.QuestionId == x.QuestionId).Sum(m => (m.Score ?? 0) + (m.AdjustScore ?? 0)) |
|
|
|
RealScore = details.Where(m => m.QuestionId == x.QuestionId).Sum(m => (m.Score ?? 0) + (m.AdjustScore ?? 0)), |
|
|
|
|
|
|
|
//ExamRecordDetailId = details.Where(m => m.QuestionId == x.QuestionId).First()?.Id |
|
|
|
}).ToList(); |
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
var questionIds = previews.Select(x => x.QuestionId).Distinct().ToList(); |
|
|
|
var questionIds = previews.Select(x => x.QuestionId).Distinct().ToList(); |
|
|
@ -252,6 +253,9 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
x.detail = detail; |
|
|
|
x.detail = detail; |
|
|
|
|
|
|
|
|
|
|
|
var recordDetail = details.FirstOrDefault(m => m.ExamPaperQuestionId == x.Id); |
|
|
|
var recordDetail = details.FirstOrDefault(m => m.ExamPaperQuestionId == x.Id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (recordDetail != null) |
|
|
|
|
|
|
|
x.ExamRecordDetailId = recordDetail.Id; |
|
|
|
switch (x.QuestionType) |
|
|
|
switch (x.QuestionType) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case "Completion": |
|
|
|
case "Completion": |
|
|
@ -344,16 +348,21 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
|
|
|
|
|
|
|
|
extend.questionList.ForEach(x => |
|
|
|
extend.questionList.ForEach(x => |
|
|
|
{ |
|
|
|
{ |
|
|
|
var recordDetail = details.FirstOrDefault(m => m.ExamPaperQuestionId == x.Id); |
|
|
|
//var recordDetail = details.FirstOrDefault(m => m.ExamPaperQuestionId == x.Id); |
|
|
|
recordDetail.Score = x.RealScore; |
|
|
|
var recordDetail = details.FirstOrDefault(m => m.Id == x.ExamRecordDetailId); |
|
|
|
recordDetail.IsCorrect = x.Score == x.RealScore ? true : false; |
|
|
|
if (recordDetail != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
recordDetail.Score = x.RealScore; |
|
|
|
|
|
|
|
recordDetail.IsCorrect = x.Score == x.RealScore ? true : false; |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
var paperId = record.ExamPaperId; |
|
|
|
var paperId = record.ExamPaperId; |
|
|
|
var examPaper = await Db.Queryable<Ghre_ExamPaper>().Where(x => x.Id == paperId).FirstAsync(); |
|
|
|
var examPaper = await Db.Queryable<Ghre_ExamPaper>().Where(x => x.Id == paperId).FirstAsync(); |
|
|
|
if (examPaper != null) |
|
|
|
if (examPaper != null) |
|
|
|
record.IsPass = examPaper.PassScore > (record.Score + record.AdjustScore) ? false : true; |
|
|
|
record.IsPass = examPaper.PassScore > (record.Score + record.AdjustScore) ? false : true; |
|
|
|
|
|
|
|
record.Score = details.Sum(x => x.Score); |
|
|
|
|
|
|
|
record.Score = extend.questionList.Sum(x => x.RealScore); |
|
|
|
await Db.Updateable(record).ExecuteCommandAsync(); |
|
|
|
await Db.Updateable(record).ExecuteCommandAsync(); |
|
|
|
await Db.Updateable(details).ExecuteCommandAsync(); |
|
|
|
await Db.Updateable(details).ExecuteCommandAsync(); |
|
|
|
|
|
|
|
|
|
|
@ -448,11 +457,11 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
.Where(x => x.Id == studyRecord.ExamId) |
|
|
|
.Where(x => x.Id == studyRecord.ExamId) |
|
|
|
.FirstAsync(x => x.Status == Consts.DIC_EXAM_STATUS.RELEASED || x.Status == Consts.DIC_EXAM_STATUS.DISABLED); |
|
|
|
.FirstAsync(x => x.Status == Consts.DIC_EXAM_STATUS.RELEASED || x.Status == Consts.DIC_EXAM_STATUS.DISABLED); |
|
|
|
|
|
|
|
|
|
|
|
if (exam.IsNull()) |
|
|
|
if (exam.IsNull() && (record.Status == DIC_EXAM_RECORD_STATUS.WAIT || record.Status == DIC_EXAM_RECORD_STATUS.EXAMING)) |
|
|
|
return ServiceResult<QueryExam>.OprateFailed("该门课程尚未开启考试,请联系HR !"); |
|
|
|
return ServiceResult<QueryExam>.OprateFailed("该门课程尚未开启考试,请联系HR !"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (exam.Status == Consts.DIC_EXAM_STATUS.DISABLED) |
|
|
|
if (exam.Status == Consts.DIC_EXAM_STATUS.DISABLED && (record.Status == DIC_EXAM_RECORD_STATUS.WAIT || record.Status == DIC_EXAM_RECORD_STATUS.EXAMING)) |
|
|
|
return ServiceResult<QueryExam>.OprateFailed("该考试已归档,暂不可考试 !"); |
|
|
|
return ServiceResult<QueryExam>.OprateFailed("该考试已归档,暂不可考试 !"); |
|
|
|
|
|
|
|
|
|
|
|
var dt = Db.GetDate(); |
|
|
|
var dt = Db.GetDate(); |
|
|
@ -462,7 +471,7 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
if (!record.BeginTime.IsNull()) |
|
|
|
if (!record.BeginTime.IsNull()) |
|
|
|
record.EndTime = record.BeginTime.Value.AddDays(exam.AfterHowLong ?? 7); |
|
|
|
record.EndTime = record.BeginTime.Value.AddDays(exam.AfterHowLong ?? 7); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!(record.BeginTime.Value.Date <= dt.Date && record.EndTime.Value.Date >= dt.Date)) |
|
|
|
if (!(record.BeginTime.Value.Date <= dt.Date && record.EndTime.Value.Date >= dt.Date) && (record.Status == DIC_EXAM_RECORD_STATUS.WAIT || record.Status == DIC_EXAM_RECORD_STATUS.EXAMING)) |
|
|
|
return ServiceResult<QueryExam>.OprateFailed("考试已结束!"); |
|
|
|
return ServiceResult<QueryExam>.OprateFailed("考试已结束!"); |
|
|
|
|
|
|
|
|
|
|
|
var details = await Db.Queryable<Ghre_ExamRecordDetail>().Where(x => x.ExamRecordId == record.Id).ToListAsync(); |
|
|
|
var details = await Db.Queryable<Ghre_ExamRecordDetail>().Where(x => x.ExamRecordId == record.Id).ToListAsync(); |
|
|
@ -494,7 +503,7 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
extend.styleInfo.paperStyle = exampaper.Style; |
|
|
|
extend.styleInfo.paperStyle = exampaper.Style; |
|
|
|
extend.styleInfo.coverBackGround = exampaper.CoverBackGround; |
|
|
|
extend.styleInfo.coverBackGround = exampaper.CoverBackGround; |
|
|
|
|
|
|
|
|
|
|
|
if (exampaper.SetMethod == DIC_EXAM_PAPER_SET_METHOD.RANDOM && record.Status != DIC_EXAM_RECORD_STATUS.EXAM_END) |
|
|
|
if (exampaper.SetMethod == DIC_EXAM_PAPER_SET_METHOD.RANDOM && record.Status != DIC_EXAM_RECORD_STATUS.EXAM_END && record.Status != DIC_EXAM_RECORD_STATUS.SYSTEM_END) |
|
|
|
{ |
|
|
|
{ |
|
|
|
await Db.Deleteable<Ghre_ExamPaperQuestion>().Where(x => x.ExamPaperId == examRecordId).ExecuteCommandAsync(); |
|
|
|
await Db.Deleteable<Ghre_ExamPaperQuestion>().Where(x => x.ExamPaperId == examRecordId).ExecuteCommandAsync(); |
|
|
|
var configs = await Db.Queryable<Ghre_ExamPaperConfig>().OrderBy(x => x.TaxisNo).Where(x => x.ExamPaperId == exampaper.Id).ToListAsync(); |
|
|
|
var configs = await Db.Queryable<Ghre_ExamPaperConfig>().OrderBy(x => x.TaxisNo).Where(x => x.ExamPaperId == exampaper.Id).ToListAsync(); |
|
|
@ -540,7 +549,8 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
QuestionId = x.QuestionId.Value, |
|
|
|
QuestionId = x.QuestionId.Value, |
|
|
|
ExamPaperId = x.ExamPaperId, |
|
|
|
ExamPaperId = x.ExamPaperId, |
|
|
|
Score = x.Score, |
|
|
|
Score = x.Score, |
|
|
|
RealScore = details.Where(m => m.QuestionId == x.QuestionId).Sum(m => (m.Score ?? 0) + (m.AdjustScore ?? 0)) |
|
|
|
RealScore = details.Where(m => m.QuestionId == x.QuestionId).Sum(m => (m.Score ?? 0) + (m.AdjustScore ?? 0)), |
|
|
|
|
|
|
|
//ExamRecordDetailId = details.Where(m => m.QuestionId == x.QuestionId).First()?.Id |
|
|
|
}).ToList(); |
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
var questionIds = previews.Select(x => x.QuestionId).Distinct().ToList(); |
|
|
|
var questionIds = previews.Select(x => x.QuestionId).Distinct().ToList(); |
|
|
@ -578,6 +588,8 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
x.detail = detail; |
|
|
|
x.detail = detail; |
|
|
|
|
|
|
|
|
|
|
|
var recordDetail = details.FirstOrDefault(m => m.ExamPaperQuestionId == x.Id); |
|
|
|
var recordDetail = details.FirstOrDefault(m => m.ExamPaperQuestionId == x.Id); |
|
|
|
|
|
|
|
if (recordDetail != null) |
|
|
|
|
|
|
|
x.ExamRecordDetailId = recordDetail.Id; |
|
|
|
switch (x.QuestionType) |
|
|
|
switch (x.QuestionType) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case "Completion": |
|
|
|
case "Completion": |
|
|
@ -659,6 +671,12 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
extend.IsAllowView = false; |
|
|
|
extend.IsAllowView = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (record.Status == DIC_EXAM_RECORD_STATUS.SYSTEM_END) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
extend.IsAllowView = false; |
|
|
|
|
|
|
|
extend.IsMissExam = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ServiceResult<QueryExam>.OprateSuccess("查询成功!", extend); |
|
|
|
return ServiceResult<QueryExam>.OprateSuccess("查询成功!", extend); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|