numerous improvements and fixes

This commit is contained in:
Ross
2020-12-26 20:45:26 +00:00
parent 33077cbdd6
commit d47462be98
8 changed files with 34 additions and 41 deletions
+1 -9
View File
@@ -4,14 +4,6 @@
<div class="physics">
<h2>{{ exam.name }}</h2>
{% for user, value in user_answers_marks.items %}
<h3>Candidate: <a href="{% url 'cid_scores' user %}">{{ user_names|get_item:user }}</a></h3>
<!-- Answers: {{ user_answers_and_marks|get_item:user }}-->
Answers: {% for ans, score in user_answers_and_marks|get_item:user %}
{{ans}} ({{score}}),
{% endfor %}
<br /> Total mark: {{ user_scores|get_item:user }}
{% endfor %}
</div>
<div id="stats-block">
<h2>Stats</h2>
@@ -27,7 +19,7 @@
</tr>
{% for user, value in user_answers_marks.items %}
<tr>
<td>{{user}}</td>
<td><a href="{% url 'cid_scores' user %}">{{user}}</a></td>
<td>{{user_scores|get_item:user}}</td>
</tr>
{% endfor %}
@@ -10,7 +10,7 @@
<li class="user-answer-li">Question {{forloop.counter}} - {{ question.stem }}</li>
<ol type="a">
{% for q, a, score, correct_answer in ans %}
<li>{{q}}: {{a}} <br />Correct answer: {{correct_answer}} <span class="answer-{{score}}">(Score: {{score}})</span></li>
<li>{{q}}: Correct answer: {{correct_answer}} <br />{{a}} <span class="answer-{{score}}">(Score: {{score}})</span></li>
{% endfor %}
</ol>
{% endfor %}
+11 -16
View File
@@ -13,6 +13,7 @@
saved)
</p>
{% autoescape off %}
<ol id="full-question-list-physics">
{% for question in questions.all %}
@@ -53,6 +54,8 @@
</li>
{% endfor %}
</ol>
{% endautoescape %}
<button id="submit">Submit answers</button>
@@ -61,7 +64,7 @@
<script type="text/javascript">
window.answers_submitted = true;
window.answers_submitted = false;
$(document).ready(function () {
console.log($(".question-text"));
$(".question-text").click(function (evt) {
@@ -113,21 +116,13 @@ function postAnswers(ans) {
);
if (ret) {
window.saveSession();
window.answers_submitted = true;
if (config.exam_results_url != "") {
let url = config.exam_results_url;
//window.saveSession();
if (window.cid != "") {
url = url + window.cid;
}
$("#options-link")
.empty()
.append(
`<a href="${url}" target="_blank"><div class="packet-button">Results and answers</div></a>`
);
}
$("#options-panel").show();
$("#submit").after('<button id="exams-button-link">Return to exam list</button>');
$("#exams-button-link").click(() => {
window.location.href = "{% url 'physics:active_exams' %}";
})
window.answers_submitted = true;
} else {
}
} else {
@@ -144,7 +139,7 @@ function postAnswers(ans) {
.truefalse-switch {
position: relative;
display: inline-block;
width: 90px;
width: 100px;
height: 20px;
margin: 0px;
margin-bottom: -5px;