{# Aggregated response summary partial for physics questions (HTMX-loadable) #}
{% if exam_response_total %}
Total responses: {{ exam_response_total }}
{# Per-part TF breakdown (A-E) #} {% if per_part_stats %}
{% for part in per_part_stats %} {# colour by percent-correct: green >=75, warning >=50, red otherwise #}
{{ part.part|upper }}
{{ part.correct_count }} / {{ part.total }}
Correct: {{ part.correct_pct }}%
{% endfor %}
{% endif %}
Correct:
{% if exam_response_correct_count is not None %} {{ exam_response_correct_count }} {% if exam_response_correct_pct is not None %} ({{ exam_response_correct_pct }}%) {% endif %} {% else %} N/A {% endif %}
{# Render top-level answer breakdown from exam_response_counts and pcts #} {% for item in exam_response_items %}
{% if item.parts %}
{% for part in item.parts %} {% with pstats=per_part_stats|get_item:forloop.counter0 %} {% if pstats %} {% if pstats.correct_pct >= 75 %} {{ part.value|yesno:"T,F" }} {% elif pstats.correct_pct >= 50 %} {{ part.value|yesno:"T,F" }} {% else %} {{ part.value|yesno:"T,F" }} {% endif %} {% else %} {% if part.is_correct == True %} {{ part.value|yesno:"T,F" }} {% elif part.is_correct == False %} {{ part.value|yesno:"T,F" }} {% else %} {{ part.value|default:"-" }} {% endif %} {% endif %} {% endwith %} {% endfor %}
{% else %}
{{ item.key }}
{% endif %}
{{ item.count }} {{ item.pct }}%
{% endfor %}
Correct answer
{% if correct_answer %}
{{ correct_answer }}
{% else %}
No correct answer available.
{% endif %}
{% else %}
No responses recorded for this question in the exam yet.
{% endif %}