Add logic to display Reviewed badges for submitted exams and update exam link parameters
This commit is contained in:
@@ -154,6 +154,9 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Exam-level state exposed to the script so we can show Reviewed badges
|
||||
const examResultsPublished = {{ exam.publish_results|yesno:'true,false' }};
|
||||
|
||||
function highlightSubmitted(){
|
||||
// Find any submitted rows (table rows or list items) that include
|
||||
// data attributes for cid/user. Then insert a small badge on matching list items.
|
||||
@@ -205,9 +208,17 @@
|
||||
const t = `Started\nFirst: ${info.first}`;
|
||||
ensureBadge(li, '.started-badge', 'started-badge badge bg-info ms-2', 'Started', t);
|
||||
}
|
||||
// add Submitted badge if end time exists (or always keep submitted)
|
||||
const title = (info.first || info.last) ? `Submitted\nFirst: ${info.first}\nLast: ${info.last}` : 'Submitted';
|
||||
ensureBadge(li, '.submitted-badge', 'submitted-badge badge bg-success ms-2', 'Submitted', title);
|
||||
// Only show a 'Completed' badge when the candidate has an end time
|
||||
if(info.last){
|
||||
const tComp = `Completed\nFirst: ${info.first}\nLast: ${info.last}`;
|
||||
ensureBadge(li, '.completed-badge', 'completed-badge badge bg-primary ms-2', 'Completed', tComp);
|
||||
|
||||
// If the exam results have been published (reviewed), show Reviewed/Submitted badge in green
|
||||
if(examResultsPublished){
|
||||
const t = `Reviewed\nFirst: ${info.first}\nLast: ${info.last}`;
|
||||
ensureBadge(li, '.submitted-badge', 'submitted-badge badge bg-success ms-2', 'Reviewed', t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(e){ console.error('highlightSubmitted CID item error', e); }
|
||||
});
|
||||
@@ -225,8 +236,14 @@
|
||||
const t = `Started\nFirst: ${info.first}`;
|
||||
ensureBadge(li, '.started-badge', 'started-badge badge bg-info ms-2', 'Started', t);
|
||||
}
|
||||
const title = (info.first || info.last) ? `Submitted\nFirst: ${info.first}\nLast: ${info.last}` : 'Submitted';
|
||||
ensureBadge(li, '.submitted-badge', 'submitted-badge badge bg-success ms-2', 'Submitted', title);
|
||||
if(info.last){
|
||||
const tComp = `Completed\nFirst: ${info.first}\nLast: ${info.last}`;
|
||||
ensureBadge(li, '.completed-badge', 'completed-badge badge bg-primary ms-2', 'Completed', tComp);
|
||||
if(examResultsPublished){
|
||||
const t = `Reviewed\nFirst: ${info.first}\nLast: ${info.last}`;
|
||||
ensureBadge(li, '.submitted-badge', 'submitted-badge badge bg-success ms-2', 'Reviewed', t);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user