diff --git a/generic/templates/generic/exam_cids.html b/generic/templates/generic/exam_cids.html index 7d185bef..6427609e 100644 --- a/generic/templates/generic/exam_cids.html +++ b/generic/templates/generic/exam_cids.html @@ -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; } } diff --git a/templates/cid_scores.html b/templates/cid_scores.html index 42dfc916..e44e951e 100644 --- a/templates/cid_scores.html +++ b/templates/cid_scores.html @@ -22,7 +22,7 @@ {% for exam in exams %}
  • {{exam}} {% if exam.active %} - + {% endif %}