This commit is contained in:
Ross
2021-12-12 12:47:49 +00:00
parent 0e26d641d8
commit 85b3030e38
5 changed files with 34 additions and 25 deletions
+5 -5
View File
@@ -2,11 +2,11 @@
{% block content %}
<h2>Start exam: {{exam.name}}</h2>
<h2>Start exam: {{exam.name}}</h2>
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>
@@ -32,4 +32,4 @@ Enter your CID and passcode in the below boxes.<br />
});
});
</script>
{% endblock %}
{% endblock %}
+1 -1
View File
@@ -9,7 +9,7 @@ CID: {{cid}}
{{answer_count}} out of {{exam_length}} questions answered. Click to go to question.
<div class="sba-finish-list">
{% for question, answer in question_answer_tuples %}
<a href="{% url 'sbas:exam_take' pk=exam.id sk=forloop.counter0 cid=cid %}"><button {% if not answer %}class="unanswered"{% endif %}>{{forloop.counter}}: {{answer.answer}}</button></a>
<a href="{% url 'sbas:exam_take' pk=exam.id sk=forloop.counter0 cid=cid passcode=passcode %}"><button {% if not answer %}class="unanswered"{% endif %}>{{forloop.counter}}: {{answer.answer}}</button></a>
{% endfor %}
</div>
-1
View File
@@ -28,7 +28,6 @@
{% if exam.publish_results %}checked{% endif %}> <span class="help-text">[When checked the exam results will
be available on this site]</span>
</div>
<!--<p><button><a href="{% url 'anatomy:exam_take' pk=exam.pk sk=0 %}">Click here to start</a></button></p>-->
This exam will be available to take <a href="{% url 'sbas:exam_start' pk=exam.pk %}">here</a> (when active).
{% autoescape off %}
+1 -1
View File
@@ -7,7 +7,7 @@
Answers:
<ul>
{% for question, a, score, correct_answer in answers_and_marks %}
<li class="user-answer-li"><a href="{% url 'sbas:exam_take' exam.pk forloop.counter0 cid %}">Question
<li class="user-answer-li"><a href="{% url 'sbas:exam_take' exam.pk forloop.counter0 cid passcode %}">Question
{{forloop.counter}}</a> - {{ question.stem |safe}}</li>
<span>Correct answer: {{correct_answer|safe}} <br />{{a}} <span class="answer-{{score}}">(Score:
{{score}})</span></span>
+27 -17
View File
@@ -2,24 +2,34 @@
{% block content %}
<h2>{{exam.name}}</h2>
<h2>Start exam: {{exam.name}}</h2>
Enter your CID in the below box.<br />
<input id="cid-box" type="text" value="Candidate ID">
<button>Start exam</button>
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>
<script type="text/javascript">
$(document).ready(function () {
$("button").click(() => {
let cid = $("#cid-box").val();
<button>Start exam</button>
if (Number.isInteger(parseInt(cid))) {
window.location.replace("{% url 'sbas:exam_take' pk=exam.pk sk=0 cid='0000000' %}".replace("0000000", cid));
} else {
alert("Please enter a valid Candidate ID (CID).")
}
<script type="text/javascript">
$(document).ready(function () {
$("#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();
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>
{% endblock %}
</script>
{% endblock %}