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
+15
View File
@@ -23,14 +23,29 @@ a, a:link {
color: green;
}
.answer-list .correct::after{
content: " [Score = 2]";
font-size: small;
}
.answer-list .half-correct {
color: yellow;
}
.answer-list .half-correct::after{
content: " [Score = 1]";
font-size: small;
}
.answer-list .incorrect {
color: red;
}
.answer-list .incorrect::after{
content: " [Score = 0]";
font-size: small;
}
.answer-list .not-marked {
color: lightblue;
}
+1 -1
View File
@@ -8,7 +8,7 @@ var marked_answers = {
$(document).ready(function () {
$(".answer-list li").each(function (index, element) {
$(element).append($("<span class='google-link' title='search in google'><a href='https://www.google.com/search?q="+$(element).text()+"' target='_blank'>G</a></span>"));
$(element).append($("<span class='google-link' title='search for answer with google'><a href='https://www.google.com/search?q="+$(element).text()+"' target='_blank'>G</a></span>"));
});
$(".answer-list span.answer").each(function (index, element) {
+3 -12
View File
@@ -12,21 +12,12 @@
{% endif %}
{% 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>
Mean: {{mean}}, Median {{median}}, Mode {{mode}}
<h3>Distribution of results</h3>
<div id="stats-plot">{{plot|safe}}</div>
<div id="stats-plot"><h3>Distribution of results</h3>{{plot|safe}}</div>
</div>
<div>
<table>
@@ -36,7 +27,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 %}
+1 -1
View File
@@ -625,7 +625,7 @@ def exam_scores_cid(request, pk):
mode = "No unique mode"
df = user_scores_list
fig = px.histogram(df, x=0)
fig = px.histogram(df, x=0, title="Distribution of scores", labels={"0": "Score"}, height=400, width=600)
fig_html = fig.to_html()
total = len(questions)
+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;
+1 -1
View File
@@ -176,7 +176,7 @@ def exam_scores_cid(request, pk):
mode = "No unique mode"
df = user_scores_list
fig = px.histogram(df, x=0)
fig = px.histogram(df, x=0, title="Distribution of scores", labels={0: "Score"})
fig_html = fig.to_html()
total = len(questions)