{# Partial: render questions and answers as HTML. #}
{% if casedetail.question_schema %}
Questions
{% for name, prop in casedetail.question_schema.properties.items %}
{{ prop.title|default:name }}
{% if prop.description %}
{{ prop.description }}
{% endif %}
{% if prop.type == "string" and prop.enum %}
Options: {{ prop.enum|join:", " }}
{% else %}
Type: {{ prop.type }}
{% endif %}
{# Safely fetch the stored/example answer using the project's `get_item` filter. #}
{% if casedetail.question_answers %}
{% with correct=casedetail.question_answers|get_item:name %}
Example / Correct:
{% if correct %}
{{ correct }}
{% else %}
(no answer provided)
{% endif %}
{% endwith %}
{% else %}
Example / Correct:(no answer provided)
{% endif %}
{# Optionally render and compare a user's answer passed as `user_answer` in the context #}
{% if user_answer %}
{% if user_answer|get_item:name %}
{% with ua=user_answer|get_item:name %}
{% with correct=casedetail.question_answers|get_item:name %}
Your answer:{{ ua }}
{% if ua == correct %}
Correct
{% else %}
Incorrect
{% endif %}