Add independent subject pass rules and atomic score imports
This commit is contained in:
@@ -32,6 +32,9 @@ export function createCandidateRoutes(context) {
|
||||
publicExam,
|
||||
examRegistrationView,
|
||||
examResultSummary,
|
||||
subjectPassText,
|
||||
resultRankInfo,
|
||||
subjectPassEvaluation,
|
||||
logAction,
|
||||
excelResourceNames,
|
||||
excelRowsForResource,
|
||||
@@ -128,7 +131,15 @@ export function createCandidateRoutes(context) {
|
||||
const subject = exam.subjects.find(item => item.id === result.subjectId);
|
||||
const appealInstance = db.workflowInstances.find(item => item.businessType === 'score_appeal' && item.businessId === result.id);
|
||||
const appeal = appealInstance ? workflowView(db, appealInstance) : null;
|
||||
return { ...result, examId: exam.id, examName: exam.name, examCode: exam.code, subjectName: subject?.name || result.subjectId, fullScore: subject?.fullScore || 150, passScore: subject?.passScore || 90, appeal: appeal ? { ...appeal, reason: appeal.actions.find(action => action.action === 'submit')?.note || '' } : null };
|
||||
const rank = resultRankInfo(db, result);
|
||||
const pass = subjectPassEvaluation(db, result, subject);
|
||||
return {
|
||||
...result, ...rank, grade: rank.grade, examId: exam.id, examName: exam.name, examCode: exam.code, examStart: exam.examStart,
|
||||
subjectName: subject?.name || result.subjectId, fullScore: subject?.fullScore || 150,
|
||||
passRule: subject?.passRule || 'fixed_score', passValue: subject?.passValue ?? subject?.passScore,
|
||||
passScore: pass.passScore, cutoffRank: pass.cutoffRank, passText: subjectPassText(subject), qualified: pass.qualified,
|
||||
appeal: appeal ? { ...appeal, reason: appeal.actions.find(action => action.action === 'submit')?.note || '' } : null
|
||||
};
|
||||
});
|
||||
const summaries = registrations.map(registration => examResultSummary(db, registration)).filter(summary => summary?.publishedSubjects);
|
||||
return sendJson(response, 200, { ok: true, results, summaries });
|
||||
|
||||
Reference in New Issue
Block a user