{% extends "base.html" %} {% block content %}

Questions for Chapter: {{ chapter_code }}

{% set ns = namespace(last_pid=None) %} {% for subject, groups in grouped.items()|sort %}
Subject: {{ subject }}
{% for group, qs in groups.items()|sort %}
Group: {{ group }}
    {% for q in qs|sort(attribute='question_number') %} {# ---------- Reading passage: print once when it changes ---------- #} {% if q.passage_id and q.passage_id != ns.last_pid %} {% set _p = get_passage(q.passage_id) %} {% if _p and _p.content %}
  • ๐Ÿ“– Reading Passage
    {{ _p.content }}
  • {% set ns.last_pid = q.passage_id %} {% endif %} {% endif %}
  • {{ q.question_number }}.
    {% if q.marks %} {{ q.marks }} marks {% endif %} {% if q.paper %} {{ q.paper }} {% endif %} {% if q.syllabus_code %} {{ q.syllabus_code }} {% endif %} {% set _et = (q.exam_type or 'open')|lower %} {% if _et != 'open' %} {{ _et|capitalize }} {% endif %}
    {% if q.source %} {% set _src_parts = [] %} {% for _s in q.source.split('\n') %} {% if _s.strip() and _s.strip() not in _src_parts %} {% set _ = _src_parts.append(_s.strip()) %} {% endif %} {% endfor %} {% if _src_parts %}
    ๐Ÿ”– {{ _src_parts | join(' ยท ') }}
    {% endif %} {% endif %}
    {% if q.nepali_transcription and q.english_transcription %} {{ q.nepali_transcription|safe }} ({{ q.english_transcription|safe }}) {% elif q.nepali_transcription %} {{ q.nepali_transcription|safe }} {% elif q.english_transcription %} {{ q.english_transcription|safe }} {% endif %}
    {# ---------- MULTICHOICE ---------- #} {% if q.type == 'multichoice' and q.options %}
      {% for opt in q.options %}
    • {{ 'ABCDEFGH'[loop.index0] }}. {{ opt.text|safe }} {% if opt.correct %}โœ“{% endif %}
    • {% endfor %}
    {# ---------- TRUE / FALSE ---------- #} {% elif q.type == 'truefalse' and q.options %}
      {% for opt in q.options %}
    • ( ) (โœ“) {{ opt.text }}
    • {% endfor %}
    {# ---------- MATCHING ---------- #} {% elif q.type == 'matching' and q.pairs %}
    Sub-questions
      {% for pair in q.pairs %}
    1. {{ pair.subquestion }}
    2. {% endfor %}
    Answer bank
    {% set seen_answers = [] %} {% for pair in q.pairs %} {% if pair.answer not in seen_answers %} {% set _ = seen_answers.append(pair.answer) %} {% endif %} {% endfor %}
      {% for ans in seen_answers|sort %}
    • {{ ans }}
    • {% endfor %}
    {% for pair in q.pairs %} {% endfor %}
    {{ pair.subquestion }} โ†” {{ pair.answer }}
    {% endif %} {# ---------- General feedback (answer mode only) ---------- #} {% if q.general_feedback %}
    ๐Ÿ’ก Explanation: {{ q.general_feedback|safe }}
    {% endif %}
  • {% endfor %}
{% endfor %} {% endfor %}
{% endblock %}