{% extends "base.html.j2" %}

{% block content %}
{% if session['submitted'] %}
    {%if data['size']%}
        {% if  session['additional_request']['set']%}
            <div><p>CompTIA Security+ questions with focus on <b>{{session['additional_request']['value']}}</b></p></div>
        {% else %}
            <div><p>General CompTIA Security+ questions.</p></div>
        {% endif %}
    {% else %}
        <div><p>No questions were generated. This may be due to high server load. Please try again in a few moments.</p></div>
    {% endif %}
    <div>
    <form id="answerForm" action="{{ url_for('check') }}" method="POST">
    {% for q_index in range(data['size']) %}
        <div class="question-block">
            <p><strong>{{ data["questions"][q_index]['question'] }}</strong></p>

            {% for ch_index in range(4) %}
                <label>
                    <input type="radio" name="{{ q_index }}" value="{{ ch_index }}" required>
                    {{ data["questions"][q_index]['choices'][ch_index]['option'] }}
                </label>
            {% endfor %}
        </div>
    {% endfor %}
        {%if data['size']%}
            <button class="submit-answers-button" type="submit">Submit Answers</button>
        {%endif%}
</form>
</div>
{% endif %}

{% endblock content %}
