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; color: green;
} }
.answer-list .correct::after{
content: " [Score = 2]";
font-size: small;
}
.answer-list .half-correct { .answer-list .half-correct {
color: yellow; color: yellow;
} }
.answer-list .half-correct::after{
content: " [Score = 1]";
font-size: small;
}
.answer-list .incorrect { .answer-list .incorrect {
color: red; color: red;
} }
.answer-list .incorrect::after{
content: " [Score = 0]";
font-size: small;
}
.answer-list .not-marked { .answer-list .not-marked {
color: lightblue; color: lightblue;
} }
+1 -1
View File
@@ -8,7 +8,7 @@ var marked_answers = {
$(document).ready(function () { $(document).ready(function () {
$(".answer-list li").each(function (index, element) { $(".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) { $(".answer-list span.answer").each(function (index, element) {
+3 -12
View File
@@ -12,21 +12,12 @@
{% endif %} {% 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>
<div id="stats-block"> <div id="stats-block">
<h2>Stats</h2> <h2>Stats</h2>
Mean: {{mean}}, Median {{median}}, Mode {{mode}} 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>
<div> <div>
<table> <table>
@@ -36,7 +27,7 @@
</tr> </tr>
{% for user, value in user_answers_marks.items %} {% for user, value in user_answers_marks.items %}
<tr> <tr>
<td>{{user}}</td> <td><a href="{% url 'cid_scores' user %}">{{user}}</a></td>
<td>{{user_scores|get_item:user}}</td> <td>{{user_scores|get_item:user}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
+1 -1
View File
@@ -625,7 +625,7 @@ def exam_scores_cid(request, pk):
mode = "No unique mode" mode = "No unique mode"
df = user_scores_list 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() fig_html = fig.to_html()
total = len(questions) total = len(questions)
+1 -9
View File
@@ -4,14 +4,6 @@
<div class="physics"> <div class="physics">
<h2>{{ exam.name }}</h2> <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>
<div id="stats-block"> <div id="stats-block">
<h2>Stats</h2> <h2>Stats</h2>
@@ -27,7 +19,7 @@
</tr> </tr>
{% for user, value in user_answers_marks.items %} {% for user, value in user_answers_marks.items %}
<tr> <tr>
<td>{{user}}</td> <td><a href="{% url 'cid_scores' user %}">{{user}}</a></td>
<td>{{user_scores|get_item:user}}</td> <td>{{user_scores|get_item:user}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
@@ -10,7 +10,7 @@
<li class="user-answer-li">Question {{forloop.counter}} - {{ question.stem }}</li> <li class="user-answer-li">Question {{forloop.counter}} - {{ question.stem }}</li>
<ol type="a"> <ol type="a">
{% for q, a, score, correct_answer in ans %} {% 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 %} {% endfor %}
</ol> </ol>
{% endfor %} {% endfor %}
+11 -16
View File
@@ -13,6 +13,7 @@
saved) saved)
</p> </p>
{% autoescape off %}
<ol id="full-question-list-physics"> <ol id="full-question-list-physics">
{% for question in questions.all %} {% for question in questions.all %}
@@ -53,6 +54,8 @@
</li> </li>
{% endfor %} {% endfor %}
</ol> </ol>
{% endautoescape %}
<button id="submit">Submit answers</button> <button id="submit">Submit answers</button>
@@ -61,7 +64,7 @@
<script type="text/javascript"> <script type="text/javascript">
window.answers_submitted = true; window.answers_submitted = false;
$(document).ready(function () { $(document).ready(function () {
console.log($(".question-text")); console.log($(".question-text"));
$(".question-text").click(function (evt) { $(".question-text").click(function (evt) {
@@ -113,21 +116,13 @@ function postAnswers(ans) {
); );
if (ret) { if (ret) {
window.saveSession(); //window.saveSession();
window.answers_submitted = true;
if (config.exam_results_url != "") {
let url = config.exam_results_url;
if (window.cid != "") { $("#submit").after('<button id="exams-button-link">Return to exam list</button>');
url = url + window.cid; $("#exams-button-link").click(() => {
} window.location.href = "{% url 'physics:active_exams' %}";
$("#options-link") })
.empty() window.answers_submitted = true;
.append(
`<a href="${url}" target="_blank"><div class="packet-button">Results and answers</div></a>`
);
}
$("#options-panel").show();
} else { } else {
} }
} else { } else {
@@ -144,7 +139,7 @@ function postAnswers(ans) {
.truefalse-switch { .truefalse-switch {
position: relative; position: relative;
display: inline-block; display: inline-block;
width: 90px; width: 100px;
height: 20px; height: 20px;
margin: 0px; margin: 0px;
margin-bottom: -5px; margin-bottom: -5px;
+1 -1
View File
@@ -176,7 +176,7 @@ def exam_scores_cid(request, pk):
mode = "No unique mode" mode = "No unique mode"
df = user_scores_list 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() fig_html = fig.to_html()
total = len(questions) total = len(questions)