.
This commit is contained in:
@@ -329,6 +329,10 @@ img.uploading:hover {
|
|||||||
color: lightblue;
|
color: lightblue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.physics-ans .user-answer-score-1 {
|
||||||
|
color: lightblue;
|
||||||
|
}
|
||||||
|
|
||||||
td.user-answer-score-0::after {
|
td.user-answer-score-0::after {
|
||||||
content: "✗";
|
content: "✗";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="stats-block">
|
<div id="stats-block">
|
||||||
<h2>Stats</h2>
|
<h2>Stats</h2>
|
||||||
|
Max score: {{max_score}}<br />
|
||||||
Mean: {{mean}}, Median {{median}}, Mode {{mode}}
|
Mean: {{mean}}, Median {{median}}, Mode {{mode}}
|
||||||
|
|
||||||
<div id="stats-plot"><h3>Distribution of results</h3>{{plot|safe}}</div>
|
<div id="stats-plot">
|
||||||
|
<h3>Distribution of results</h3>{{plot|safe}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<table>
|
<table>
|
||||||
@@ -25,4 +28,37 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
<div>
|
||||||
|
<h3>Answers as a table</h3>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Candidate</th>
|
||||||
|
{% for cid in cids %}
|
||||||
|
<th>{{cid}}</th>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
{% for question in questions %}
|
||||||
|
<tr>
|
||||||
|
<td>Question {{forloop.counter}}</td>
|
||||||
|
{% for zipped_answers in by_question|get_item:question %}
|
||||||
|
<td>
|
||||||
|
<ol class="physics-ans" style="list-style-type: lower-alpha;">
|
||||||
|
{% for ans, score in zipped_answers %}
|
||||||
|
<li class="user-answer-score-{{score}}" title="answer score: {{score}}">{{ans}}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ol>
|
||||||
|
</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
<tr>
|
||||||
|
<td>Score:</td>
|
||||||
|
{% for score in user_scores_list %}
|
||||||
|
<td>{{score}}</td>
|
||||||
|
{% endfor %}
|
||||||
|
<tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
+11
-1
@@ -134,6 +134,7 @@ def exam_scores_cid(request, pk):
|
|||||||
user_answers = defaultdict(list)
|
user_answers = defaultdict(list)
|
||||||
user_names = {}
|
user_names = {}
|
||||||
|
|
||||||
|
by_question = defaultdict(list)
|
||||||
unmarked = set()
|
unmarked = set()
|
||||||
|
|
||||||
# Loop through all candidates
|
# Loop through all candidates
|
||||||
@@ -147,6 +148,7 @@ def exam_scores_cid(request, pk):
|
|||||||
# skip if no answer
|
# skip if no answer
|
||||||
user_answers_marks[cid].append(0)
|
user_answers_marks[cid].append(0)
|
||||||
user_answers[cid].append("")
|
user_answers[cid].append("")
|
||||||
|
by_question[q].append(("", 0))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
ans = s.get_answers()
|
ans = s.get_answers()
|
||||||
@@ -156,6 +158,10 @@ def exam_scores_cid(request, pk):
|
|||||||
user_answers_marks[cid].append(answer_scores)
|
user_answers_marks[cid].append(answer_scores)
|
||||||
user_answers_and_marks[cid].append((ans, answer_scores))
|
user_answers_and_marks[cid].append((ans, answer_scores))
|
||||||
|
|
||||||
|
zipped_ans_scores = zip(ans, answer_scores)
|
||||||
|
|
||||||
|
by_question[q].append(zipped_ans_scores)
|
||||||
|
|
||||||
user_scores = {}
|
user_scores = {}
|
||||||
for user in user_answers_marks:
|
for user in user_answers_marks:
|
||||||
user_scores[user] = sum([sum(i) for i in user_answers_marks[user]])
|
user_scores[user] = sum([sum(i) for i in user_answers_marks[user]])
|
||||||
@@ -179,20 +185,24 @@ def exam_scores_cid(request, pk):
|
|||||||
fig = px.histogram(df, x=0, title="Distribution of scores", labels={"0": "Score"}, height=400, width=600)
|
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)
|
max_score = len(questions)
|
||||||
|
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"physics/exam_scores.html",
|
"physics/exam_scores.html",
|
||||||
{
|
{
|
||||||
|
"cids": cids,
|
||||||
"exam": exam,
|
"exam": exam,
|
||||||
"unmarked": unmarked,
|
"unmarked": unmarked,
|
||||||
"questions": questions,
|
"questions": questions,
|
||||||
|
"by_question": by_question,
|
||||||
"user_answers": dict(user_answers),
|
"user_answers": dict(user_answers),
|
||||||
"user_answers_marks": dict(user_answers_marks),
|
"user_answers_marks": dict(user_answers_marks),
|
||||||
"user_scores": user_scores,
|
"user_scores": user_scores,
|
||||||
|
"user_scores_list": user_scores_list,
|
||||||
"user_names": user_names,
|
"user_names": user_names,
|
||||||
"user_answers_and_marks": user_answers_and_marks,
|
"user_answers_and_marks": user_answers_and_marks,
|
||||||
|
"max_score": max_score,
|
||||||
"mean": mean,
|
"mean": mean,
|
||||||
"median": median,
|
"median": median,
|
||||||
"mode": mode,
|
"mode": mode,
|
||||||
|
|||||||
Reference in New Issue
Block a user