86 lines
3.4 KiB
HTML
86 lines
3.4 KiB
HTML
{% extends 'base.html' %}
|
|
|
|
{% block content %}
|
|
<span id="user-id">
|
|
{% if not cid %}
|
|
User: {{request.user}}
|
|
{% else %}
|
|
CID: {{cid}}
|
|
{% endif %}
|
|
</span>
|
|
{% include "exam_clock.html" %}
|
|
|
|
<h2>Exam: {{exam}}</h2>
|
|
|
|
{% if exam.publish_results %}
|
|
<div class="alert alert-primary review-mode-alert" role="alert">
|
|
Exam is in review mode. Score are available
|
|
{% if request.user.is_authenticated %}
|
|
<a href="{% url 'physics:exam_scores_user' pk=exam.id %}">here</a>
|
|
|
|
{% else %}
|
|
<a href="{% url 'physics:exam_scores_cid_user' pk=exam.id cid=cid passcode=passcode %}">here</a>
|
|
{% endif %}
|
|
</div>
|
|
{% elif cid_user_exam.completed %}
|
|
<div class="alert alert-primary review-mode-alert" role="alert">
|
|
Exam completed. Answers are available
|
|
{% if request.user.is_authenticated %}
|
|
<a href="{% url 'physics:exam_scores_user' pk=exam.id %}">here</a>
|
|
|
|
{% else %}
|
|
<a href="{% url 'physics:exam_scores_cid_user' pk=exam.id cid=cid passcode=passcode %}">here</a>
|
|
{% endif %}
|
|
</div>
|
|
{% elif answer_count != exam_length %}
|
|
<div id="unanswered-questions-alert" class="alert alert-warning" role="alert">
|
|
You have unanswered questions.
|
|
</div>
|
|
{% endif %}
|
|
|
|
|
|
<div class="overview-text">{{answer_count}} out of {{exam_length}} questions answered. Unanswered questions are shown in red. <p>Click to go to a question.</p></div>
|
|
<div class="physics-finish-list">
|
|
{% for question, answer in question_answer_tuples %}
|
|
{% if not cid %}
|
|
<a href="{% url 'physics:exam_take_user' pk=exam.id sk=forloop.counter0 %}"><button {% if not answer %}class="unanswered" title="You have not answered this question"{% endif %}>{{forloop.counter}}: {{answer.answer}}</button></a>
|
|
|
|
{% else %}
|
|
<a href="{% url 'physics:exam_take' pk=exam.id sk=forloop.counter0 cid=cid passcode=passcode %}"><button {% if not answer %}class="unanswered" title="You have not answered this question"{% endif %}>{{forloop.counter}}: {{answer.answer}}</button></a>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
<div id="time-details">
|
|
Start time: {{cid_user_exam.start_time}}<br/>
|
|
Last change time: {{cid_user_exam.end_time}}<br/>
|
|
Completed: {{cid_user_exam.completed}}
|
|
</div>
|
|
|
|
{% if not cid_user_exam.completed %}
|
|
{% if not cid %}
|
|
<button hx-get="{% url 'physics:exam_complete_user' pk=exam.id %}" hx-swap="outerHTML" hx-confirm="Finish exam?">Finish Exam</button>
|
|
{% else %}
|
|
<button hx-get="{% url 'physics:exam_complete' pk=exam.id cid=cid passcode=passcode %}" hx-swap="outerHTML" hx-confirm="Finish exam?">Finish Exam</button>
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% include "physics/exam_take_help.html" %}
|
|
|
|
{% endblock %}
|
|
|
|
{% block js %}
|
|
<script>
|
|
$(document).ready(() => {
|
|
{% if not exam.publish_results and not cid_user_exam.completed %}
|
|
|
|
let time_limit = '{{exam.time_limit}}'
|
|
if (time_limit != "None") {
|
|
let end_time = new Date({{cid_user_exam.start_time|date:"U"}}*1000+parseInt('{{exam.time_limit}}')*1000);
|
|
initializeClock("clockdiv", end_time);
|
|
}
|
|
{% endif %}
|
|
|
|
})
|
|
</script>
|
|
{% endblock %}
|