Further basic integration testing

This commit is contained in:
Ross
2022-12-12 12:16:42 +00:00
parent a467f24e10
commit 73ebc838cd
9 changed files with 910 additions and 36 deletions
@@ -5,13 +5,22 @@
{% include 'user_score_header.html' %}
<ul>
{% for question, ans in answers_and_marks %}
<li class="user-answer-li"><span class="question-stem-text">Question {{forloop.counter}} - {{ question.stem|safe }}</span></li>
<ol type="a">
{% for q, a, score, correct_answer in ans %}
<li><span class="question-text">{{q|safe}}:</span> Correct answer: {{correct_answer}} <br /><span class="submitted-user-answer">{{a}} <span class="answer-{{score}}">(Score:
{{score}})</span></span></li>
{% endfor %}
</ol>
<li class="user-answer-li"><span class="question-stem-text">Question {{forloop.counter}} - {{ question.stem|safe }}</span>
<ol type="a">
{% for q, a, score, correct_answer in ans %}
<li class="question-part">
<span class="question-text">{{q|safe}}:</span> {% if exam.publish_results %}<span class="correct-answer">Correct answer: {{correct_answer}}</span>{% endif %}
<br />
<span class="submitted-user-answer">{{a}}</span>
{% if exam.publish_results %}
<span class="answer-{{score}}">
(Score: {{score}})
</span>
{% endif %}
</li>
{% endfor %}
</ol>
</li>
{% endfor %}
</ul>
{% include 'user_scores_footer.html' %}
+10 -16
View File
@@ -1,11 +1,13 @@
{% extends 'base.html' %}
{% block content %}
<span id="user-id">
{% if request.user.is_authenticated %}
User: {{request.user}}
{% else %}
CID: {{cid}}
{% endif %}
</span>
<div id="timeup">
Allocated time over.
</div>
@@ -29,15 +31,15 @@
</div>
</div>
<div class="no-select">
<h2>{{exam.name}}: Question [{{pos|add:1}}/{{exam_length}}]</h2>
<h2>{{exam.name}}: Question [<span id="question-number">{{pos|add:1}}</span>/<span id="exam-length">{{exam_length}}</span>]</h2>
{% if exam.publish_results %}
<div class="alert alert-primary" role="alert">
<div class="alert alert-primary review-mode-alert" role="alert">
Exam is in review mode. Add question feedback <a href="#" onclick="return window.create_popup_window('{% url 'feedback_create' question_type='physics' pk=question.pk %}')">here</a>.
</div>
{% endif %}
<div>
<p>{{question.stem|safe}}</p>
<p><span id="question-stem">{{question.stem|safe}}</span></p>
</div>
@@ -50,35 +52,35 @@
<li data-ans="a">
<div class="fieldWrapper flex-container">
{{ form.a.errors }}
<label for="{{ form.a.id_for_label }}" class="flex-8">{{question.a|safe}}</label>
<label for="{{ form.a.id_for_label }}" class="flex-8 question-text">{{question.a|safe}}</label>
<span class="flex-1">{{ form.a }}<span class="postinput"></span></span>
</div>
</li>
<li data-ans="b">
<div class="fieldWrapper flex-container">
{{ form.b.errors }}
<label for="{{ form.b.id_for_label }}" class="flex-8">{{question.b|safe}}</label>
<label for="{{ form.b.id_for_label }}" class="flex-8 question-text">{{question.b|safe}}</label>
<span class="flex-1">{{ form.b }}<span class="postinput"></span></span>
</div>
</li>
<li data-ans="c">
<div class="fieldWrapper flex-container">
{{ form.c.errors }}
<label for="{{ form.c.id_for_label }}" class="flex-8">{{question.c|safe}}</label>
<label for="{{ form.c.id_for_label }}" class="flex-8 question-text">{{question.c|safe}}</label>
<span class="flex-1">{{ form.c }}<span class="postinput"></span></span>
</div>
</li>
<li data-ans="d">
<div class="fieldWrapper flex-container">
{{ form.d.errors }}
<label for="{{ form.d.id_for_label }}" class="flex-8">{{question.d|safe}}</label>
<label for="{{ form.d.id_for_label }}" class="flex-8 question-text">{{question.d|safe}}</label>
<span class="flex-1">{{ form.d }}<span class="postinput"></span></span>
</div>
</li>
<li data-ans="e">
<div class="fieldWrapper flex-container">
{{ form.e.errors }}
<label for="{{ form.e.id_for_label }}" class="flex-8">{{question.e|safe}}</label>
<label for="{{ form.e.id_for_label }}" class="flex-8 question-text">{{question.e|safe}}</label>
<span class="flex-1">{{ form.e }}<span class="postinput"></span></span>
</div>
</li>
@@ -118,14 +120,6 @@
$(document).ready(() => {
/* beautify ignore:start */
{% if not exam.publish_results %}
//$("ul.physics-answer-list li").each((n, el) => {
// $(el).click((e) => {
// console.log(1, el.dataset.ans);
// $("#id_answer").val(el.dataset.ans);
// $("ul.physics-answer-list li").removeClass("selected");
// $(el).addClass("selected")
// })
//})
let time_limit = '{{exam.time_limit}}'
if (time_limit != "None") {
@@ -16,7 +16,7 @@
{% endif %} {% endcomment %}
<div><p>Questions</p></div>
{{answer_count}} out of {{exam_length}} questions answered. Click to go to question.
<div class="overview-text">{{answer_count}} out of {{exam_length}} questions answered. Click to go to question.</div>
<div class="physics-finish-list">
{% for question, answer in question_answer_tuples %}
{% if request.user.is_authenticated %}