Start using start dates for exams

This commit is contained in:
Ross
2024-07-08 09:52:01 +01:00
parent 00fa68247d
commit df462efacd
49 changed files with 235 additions and 293 deletions
+13 -13
View File
@@ -1,19 +1,19 @@
{% extends 'sbas/base.html' %}
{% block content %}
<h1>Examinations</h1>
<div class="sbas">
Active exams:<br/>
<ul>
{% for exam in exams %}
{% if exam.active %}
<li>
<a href="{% url 'sbas:exam_start' pk=exam.pk %}">{{exam.name}}</a>
</li>
{% endif %}
{% endfor %}
</ul>
<h1>Examinations</h1>
<div class="sbas">
Active exams:<br/>
<ul>
{% for exam in exams %}
{% if exam.active %}
<li>
<a href="{% url 'sbas:exam_start' pk=exam.pk %}">{{exam}}</a>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
{% endblock %}
+36 -36
View File
@@ -2,54 +2,54 @@
{% block content %}
<h2>Start exam: {{exam.name}}</h2>
<h2>Start exam: {{exam}}</h2>
{% if exam.time_limit %}
This exam has a time limit of {{ exam.get_time_limit }}. The time will start when you click the Start Exam button below.<br/>
This exam has a time limit of {{ exam.get_time_limit }}. The time will start when you click the Start Exam button below.<br/>
{% endif %}
{% if request.user.is_authenticated and valid_user %}
<a href="{% url 'sbas:exam_take_user' pk=exam.pk sk=0 %}">Start Exam</a>
<a href="{% url 'sbas:exam_take_user' pk=exam.pk sk=0 %}">Start Exam</a>
{% else %}
Enter your CID and passcode in the below boxes.<br />
<p><input id="cid-box" type="text" value="Candidate ID"></p>
<p><input id="passcode-box" type="text" value="Passcode"></p>
Enter your CID and passcode in the below boxes.<br />
<p><input id="cid-box" type="text" value="Candidate ID"></p>
<p><input id="passcode-box" type="text" value="Passcode"></p>
<button>Start exam</button>
<button>Start exam</button>
<script type="text/javascript">
$(document).ready(function () {
window.location.search.substr(1).split("&").forEach((item) =>
{
s = item.split("=");
if (s[0] == "cid") {
$("#cid-box").val(s[1]);
<script type="text/javascript">
$(document).ready(function () {
window.location.search.substr(1).split("&").forEach((item) =>
{
s = item.split("=");
if (s[0] == "cid") {
$("#cid-box").val(s[1]);
}
if (s[0] == "passcode") {
$("#passcode-box").val(s[1]);
}
if (s[0] == "passcode") {
$("#passcode-box").val(s[1]);
}
});
$("#cid-box, #passcode-box").keypress(function(e) {
// Enter pressed?
console.log(e)
if(e.which == 10 || e.which == 13) {
$("button").click();
}
});
$("#cid-box, #passcode-box").keypress(function(e) {
// Enter pressed?
console.log(e)
if(e.which == 10 || e.which == 13) {
$("button").click();
}
});
$("button").click(() => {
let cid = $("#cid-box").val();
let passcode = $("#passcode-box").val();
$("button").click(() => {
let cid = $("#cid-box").val();
let passcode = $("#passcode-box").val();
if (Number.isInteger(parseInt(cid))) {
window.location.replace("{% url 'sbas:exam_take' pk=exam.pk sk=0 cid='0000000' passcode='ZZZZZZ' %}".replace("0000000", cid).replace("ZZZZZZ", passcode));
} else {
alert("Please enter a valid Candidate ID (CID).")
}
if (Number.isInteger(parseInt(cid))) {
window.location.replace("{% url 'sbas:exam_take' pk=exam.pk sk=0 cid='0000000' passcode='ZZZZZZ' %}".replace("0000000", cid).replace("ZZZZZZ", passcode));
} else {
alert("Please enter a valid Candidate ID (CID).")
}
});
});
});
</script>
</script>
{% endif %}
{% endblock %}
+11 -11
View File
@@ -10,7 +10,7 @@
</span>
{% include "exam_clock.html" %}
<div class="no-select">
<h2>{{exam.name}}: Question [<span id="question-number">{{pos|add:1}}</span>/<span id="exam-length">{{exam_length}}</span>]</h2>
<h2>{{exam}}: 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 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='sbas' pk=question.pk %}')">here</a>.
@@ -64,16 +64,16 @@
</div>
<details><summary>Help</summary>
<p>Each question contains a list of 5 different statements. One of these is the single BEST answer.</p>
<p>Click on the correct statement to select it. Once selected it will be highlighted. </p>
<p>Your answers are saved when navigating between questions (or if the save button is clicked on the final question). An overview of all the questions can be seen by clicking on the overview button (or by clicking <a target="_blank" href="
{% if cid %}
{% url 'sbas:exam_scores_cid_user' pk=exam.pk cid=cid passcode=passcode %}
{% else %}
{% url 'sbas:exam_scores_user' pk=exam.pk %}
{% endif %}
"
>here</a>).</p>
<p>Click on the correct statement to select it. Once selected it will be highlighted. </p>
<p>Your answers are saved when navigating between questions (or if the save button is clicked on the final question). An overview of all the questions can be seen by clicking on the overview button (or by clicking <a target="_blank" href="
{% if cid %}
{% url 'sbas:exam_scores_cid_user' pk=exam.pk cid=cid passcode=passcode %}
{% else %}
{% url 'sbas:exam_scores_user' pk=exam.pk %}
{% endif %}
"
>here</a>).</p>
</details>
{% endblock %}
+10 -10
View File
@@ -2,19 +2,19 @@
{% block content %}
<span id="user-id">
{% if request.user.is_authenticated %}
User: {{request.user}}
{% else %}
CID: {{cid}}
{% endif %}
{% if request.user.is_authenticated %}
User: {{request.user}}
{% else %}
CID: {{cid}}
{% endif %}
</span>
{% include "exam_clock.html" %}
<h2>Exam: {{exam.name}}</h2>
<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
Exam is in review mode. Score are available
{% if request.user.is_authenticated %}
<a href="{% url 'sbas:exam_scores_user' pk=exam.id %}">here</a>
@@ -29,7 +29,7 @@
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="sba-finish-list">
@@ -43,8 +43,8 @@
{% endfor %}
</div>
<div id="time-details">
Start time: {{cid_user_exam.start_time}}<br/>
Last change time: {{cid_user_exam.end_time}}
Start time: {{cid_user_exam.start_time}}<br/>
Last change time: {{cid_user_exam.end_time}}
</div>
{% endblock %}
+1 -1
View File
@@ -3,7 +3,7 @@
{% block navigation %}
{{block.super}}
<br/>
Exams: {{exam.name}}->
Exams: {{exam}}->
<a href="{% url 'sbas:exam_overview' pk=exam.pk %}">Overview</a> /
<a href="{% url 'sbas:exam_scores_all' pk=exam.pk %}">Scores</a> /
<a href="{% url 'sbas:exam_cids' exam_id=exam.pk %}">Candidates</a> /
+38 -38
View File
@@ -1,44 +1,44 @@
{% extends 'sbas/base.html' %}
{% block content %}
<div class="question">
<a href="{% url 'sbas:question_update' question.id %}" title="Edit the Question">Edit</a>
<a href="{% url 'sbas:question_clone' question.id %}" title="Clone the Question">Clone</a>
<a href="{% url 'sbas:question_delete' pk=question.pk %}" title="Delete the Question">Delete</a>
<a href="{% url 'admin:sbas_question_change' question.id %}"
title="Edit the Question using the admin interface">Admin Edit</a>
<a href="#" onclick="return window.create_popup_window('{% url 'feedback_create' question_type='sbas' pk=question.pk %}')"> Add Note</a>
<div class="date">
Created: {{ question.created_date|date:"d/m/Y"}}
</div>
{% autoescape off %}
<span>{{question.stem}}</span>
<div>
<ol class="abcde">
<li>{{ question.a_answer }}</li>
<li>{{ question.b_answer }}</li>
<li>{{ question.c_answer }}</li>
<li>{{ question.d_answer }}</li>
<li>{{ question.e_answer }}</li>
</ol>
Best answer: {{ question.best_answer }} ({{question.get_correct_answer_stripped}})
</div>
{% endautoescape %}
<div>
Examinations: {% for exam in question.exams.all %}
<a href="{% url 'sbas:exam_overview' pk=exam.pk %}">{{ exam.name }}</a>
{% endfor %}
</div>
<div>
Category: {{ question.category }}
</div>
<div class="question">
<a href="{% url 'sbas:question_update' question.id %}" title="Edit the Question">Edit</a>
<a href="{% url 'sbas:question_clone' question.id %}" title="Clone the Question">Clone</a>
<a href="{% url 'sbas:question_delete' pk=question.pk %}" title="Delete the Question">Delete</a>
<a href="{% url 'admin:sbas_question_change' question.id %}"
title="Edit the Question using the admin interface">Admin Edit</a>
<a href="#" onclick="return window.create_popup_window('{% url 'feedback_create' question_type='sbas' pk=question.pk %}')"> Add Note</a>
<div class="date">
Created: {{ question.created_date|date:"d/m/Y"}}
</div>
{% autoescape off %}
<span>{{question.stem}}</span>
<div>
<ol class="abcde">
<li>{{ question.a_answer }}</li>
<li>{{ question.b_answer }}</li>
<li>{{ question.c_answer }}</li>
<li>{{ question.d_answer }}</li>
<li>{{ question.e_answer }}</li>
</ol>
Best answer: {{ question.best_answer }} ({{question.get_correct_answer_stripped}})
</div>
{% endautoescape %}
<div>
Examinations: {% for exam in question.exams.all %}
<a href="{% url 'sbas:exam_overview' pk=exam.pk %}">{{ exam }}</a>
{% endfor %}
</div>
<div>
Category: {{ question.category }}
</div>
<div>
Author: {% for user in question.author.all %}
{{ author }},
{% endfor %}
</div>
<div>
Author: {% for user in question.author.all %}
{{ author }},
{% endfor %}
</div>
{% include 'question_notes.html' %}
</div>
{% include 'question_notes.html' %}
</div>
{% endblock %}