Refactor exam review templates to enhance the display of marked answers and top submitted answers with collapsible sections and improved styling
This commit is contained in:
@@ -8,30 +8,39 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<h6>Marked answers</h6>
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
<ul class="list-group">
|
<h6 class="mb-0">Marked answers</h6>
|
||||||
{% for answer in question.answers.all|dictsortreversed:"status" %}
|
<div class="d-flex align-items-center gap-2">
|
||||||
<li class="list-group-item d-flex justify-content-between align-items-start{% if answer.status == '2' %} list-group-item-success{% elif answer.status == '1' %} list-group-item-warning{% elif answer.status == '0' %} list-group-item-secondary{% endif %}">
|
<div class="small text-muted">{{ question.answers.all|length }}</div>
|
||||||
<div>
|
<button class="btn btn-sm btn-outline-primary" type="button" data-bs-toggle="collapse" data-bs-target="#marked-answers-{{ question.pk }}" aria-expanded="false" aria-controls="marked-answers-{{ question.pk }}">Show answers</button>
|
||||||
{% if answer.proposed %}
|
</div>
|
||||||
<small class="text-muted me-2">(proposed)</small>
|
</div>
|
||||||
{% endif %}
|
|
||||||
<span>{{ answer.answer }}</span>
|
<div class="collapse mt-2" id="marked-answers-{{ question.pk }}">
|
||||||
</div>
|
<ul class="list-group">
|
||||||
<div>
|
{% for answer in question.answers.all|dictsortreversed:"status" %}
|
||||||
{% if answer.status == '2' %}
|
<li class="list-group-item d-flex justify-content-between align-items-start{% if answer.status == '2' %} list-group-item-success{% elif answer.status == '1' %} list-group-item-warning{% elif answer.status == '0' %} list-group-item-secondary{% endif %}">
|
||||||
<span class="badge bg-success">Correct</span>
|
<div>
|
||||||
{% elif answer.status == '1' %}
|
{% if answer.proposed %}
|
||||||
<span class="badge bg-warning text-dark">Half mark</span>
|
<small class="text-muted me-2">(proposed)</small>
|
||||||
{% elif answer.status == '0' %}
|
{% endif %}
|
||||||
<span class="badge bg-secondary">Incorrect</span>
|
<span>{{ answer.answer }}</span>
|
||||||
{% else %}
|
</div>
|
||||||
<span class="badge bg-light text-muted">Unmarked</span>
|
<div>
|
||||||
{% endif %}
|
{% if answer.status == '2' %}
|
||||||
</div>
|
<span class="badge bg-success">Correct</span>
|
||||||
</li>
|
{% elif answer.status == '1' %}
|
||||||
{% endfor %}
|
<span class="badge bg-warning text-dark">Half mark</span>
|
||||||
</ul>
|
{% elif answer.status == '0' %}
|
||||||
|
<span class="badge bg-secondary">Incorrect</span>
|
||||||
|
{% else %}
|
||||||
|
<span class="badge bg-light text-muted">Unmarked</span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{# Aggregated summary placeholder — auto-load via HTMX #}
|
{# Aggregated summary placeholder — auto-load via HTMX #}
|
||||||
|
|||||||
@@ -63,30 +63,39 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h6 class="mb-1">Top submitted answers</h6>
|
{# Collapsible Top submitted answers - closed by default. #}
|
||||||
{% if top_answers %}
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
<ul class="list-group">
|
<h6 class="mb-1">Top submitted answers</h6>
|
||||||
{% for a in top_answers %}
|
<button class="btn btn-sm btn-outline-primary" type="button" data-bs-toggle="collapse" data-bs-target="#top-answers-{{ q_index }}" aria-expanded="false" aria-controls="top-answers-{{ q_index }}">
|
||||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
Show answers
|
||||||
<div class="flex-grow-1">{{ a.answer_compare }}</div>
|
</button>
|
||||||
<div class="d-flex align-items-center gap-2">
|
</div>
|
||||||
{% if a.dominant_score == '2' %}
|
|
||||||
<span class="badge bg-success">Correct</span>
|
<div class="collapse mt-2" id="top-answers-{{ q_index }}">
|
||||||
{% elif a.dominant_score == '1' %}
|
{% if top_answers %}
|
||||||
<span class="badge bg-warning text-dark">Half</span>
|
<ul class="list-group">
|
||||||
{% elif a.dominant_score == '0' %}
|
{% for a in top_answers %}
|
||||||
<span class="badge bg-danger">Incorrect</span>
|
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||||
{% else %}
|
<div class="flex-grow-1">{{ a.answer_compare }}</div>
|
||||||
<span class="badge bg-secondary">Unmarked</span>
|
<div class="d-flex align-items-center gap-2">
|
||||||
{% endif %}
|
{% if a.dominant_score == '2' %}
|
||||||
<div class="small text-muted badge bg-primary" title="Submission Count">{{ a.count }}</div>
|
<span class="badge bg-success">Correct</span>
|
||||||
</div>
|
{% elif a.dominant_score == '1' %}
|
||||||
</li>
|
<span class="badge bg-warning text-dark">Half</span>
|
||||||
{% endfor %}
|
{% elif a.dominant_score == '0' %}
|
||||||
</ul>
|
<span class="badge bg-danger">Incorrect</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="small text-muted">No submitted answers yet.</div>
|
<span class="badge bg-secondary">Unmarked</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<div class="small text-muted badge bg-primary" title="Submission Count">{{ a.count }}</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% else %}
|
||||||
|
<div class="small text-muted">No submitted answers yet.</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="small text-muted">No responses recorded for this question in the exam yet.</div>
|
<div class="small text-muted">No responses recorded for this question in the exam yet.</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user