{% extends 'base.html' %}

{% block content %}
    <div class="sbas">
        {% include 'user_score_header.html' %}
        <ul>
            {% for question, a, score, correct_answer, chosen_answer in answers_and_marks %}
                <li class="user-answer-li">
                    {% if request.user.is_authenticated %}
                        <a href="{% url 'sbas:exam_take_user' pk=exam.id sk=forloop.counter0 %}">
                            Question {{forloop.counter}}
                        </a>
                    {% else %}
                        <a href="{% url 'sbas:exam_take' exam.pk forloop.counter0 cid passcode %}">
                            Question {{forloop.counter}}
                        </a>
                    {% endif %}
                    - {{ question.stem |safe}}
                    {% if exam.publish_results %}
                        <span class="correct-answer">Correct answer: {{correct_answer|safe}}</span> <br />
                    {% endif %}

                    Chosen answer: <span class="submitted-user-answer">{{a}}</span>
                    {{chosen_answer|safe}}
                    {% if exam.publish_results or view_all_results %}
                        <span class="answer-{{score}}">(Score: {{score}})</span>
                    {% endif %}

                </li>

            {% endfor %}
        </ul>
        {% include 'user_scores_footer.html' %}
    </div>
{% endblock %}