Refactor exam review response handling to include structured items with optional per-part breakdown for multi-part answers
This commit is contained in:
@@ -35,14 +35,30 @@
|
||||
|
||||
<div class="list-group mb-2">
|
||||
{# Render top-level answer breakdown from exam_response_counts and pcts #}
|
||||
{% for key, count in exam_response_items %}
|
||||
{% for item in exam_response_items %}
|
||||
<div class="list-group-item">
|
||||
<div class="d-flex w-100 justify-content-between align-items-center">
|
||||
<div>{{ key }}</div>
|
||||
<div class="text-end"><strong>{{ count }}</strong> <small class="text-muted">{{ exam_response_pcts|get_item:key|default:0 }}%</small></div>
|
||||
<div>
|
||||
{% if item.parts %}
|
||||
<div class="d-flex gap-1 align-items-center">
|
||||
{% for part in item.parts %}
|
||||
{% if part.is_correct == True %}
|
||||
<span class="badge bg-success">{{ part.value|yesno:"T,F" }}</span>
|
||||
{% elif part.is_correct == False %}
|
||||
<span class="badge bg-danger">{{ part.value|yesno:"T,F" }}</span>
|
||||
{% else %}
|
||||
<span class="badge bg-light text-muted">{{ part.value|default:"-" }}</span>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div>{{ item.key }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="text-end"><strong>{{ item.count }}</strong> <small class="text-muted">{{ item.pct }}%</small></div>
|
||||
</div>
|
||||
<div class="progress mt-2" style="height:12px;">
|
||||
<div class="progress-bar bg-primary" role="progressbar" style="width: {{ exam_response_pcts|get_item:key|default:0 }}%;" aria-valuenow="{{ exam_response_pcts|get_item:key|default:0 }}" aria-valuemin="0" aria-valuemax="100"></div>
|
||||
<div class="progress-bar bg-primary" role="progressbar" style="width: {{ item.pct }}%;" aria-valuenow="{{ item.pct }}" aria-valuemin="0" aria-valuemax="100"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user