.
This commit is contained in:
+4
-1
@@ -196,13 +196,16 @@ class CidUserAnswer(models.Model):
|
||||
def __str__(self):
|
||||
return "{}/{}/{}".format(self.cid, self.exam, self.question.pk)
|
||||
|
||||
def get_answer_string(self):
|
||||
return self.answer
|
||||
|
||||
def get_answer(self):
|
||||
return self.answer
|
||||
|
||||
def get_correct(self):
|
||||
return self.answer == self.question.best_answer
|
||||
|
||||
def get_score(self):
|
||||
def get_answer_score(self):
|
||||
if self.get_correct():
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
{% extends 'sbas/exams.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div id="stats-plot">{{plot|safe}}</div>
|
||||
<div class="sbas">
|
||||
<h2>{{ exam.name }}</h2>
|
||||
|
||||
</div>
|
||||
<div id="stats-block">
|
||||
<h3>Stats</h3>
|
||||
Candidates: {{cids|length}}<br />
|
||||
Max score: {{max_score}}<br />
|
||||
Mean: {{mean}}, Median {{median}}, Mode {{mode}}
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<table class="table table-dark table-striped table-hover table-sm cid-score-table">
|
||||
<tr>
|
||||
<th>Candidate ID</th>
|
||||
<th>Score</th>
|
||||
{% comment %} <th>Normalised Score</th> {% endcomment %}
|
||||
</tr>
|
||||
{% comment %} {% for user, value in user_answers_marks.items %} {% endcomment %}
|
||||
{% for cid in cids %}
|
||||
<tr>
|
||||
<td><a href="{% url 'cid_scores_admin' cid %}">{{cid}}</a></td>
|
||||
<td>{{user_scores|get_item:cid}}</td>
|
||||
{% comment %} <td>{{user_scores_normalised|get_item:user}}</td> {% endcomment %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h3>Answers as a table</h3>
|
||||
<table class="table table-dark table-striped table-hover table-sm col-sm">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>Candidate</th>
|
||||
{% for cid in cids %}
|
||||
{% comment %} <th><a href="{% url 'sbas:exam_scores_cid_user' exam.pk cid %}">{{cid}}</a></th> {% endcomment %}
|
||||
<th><a href="">{{cid}}</a></th>
|
||||
{% endfor %}
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
{% for question in questions %}
|
||||
<tr>
|
||||
<td><a href="">Question {{forloop.counter}}</a>
|
||||
</td>
|
||||
{% comment %} {% for cid in cids %}
|
||||
<td class="sbas-ans user-answer-score-{{score_by_question|get_item:question|get_item:cid}}" title="answer score: {{score_by_question|get_item:question|get_item:cid}}">{{ans_by_question|get_item:question|get_item:cid}}</td>
|
||||
{% endfor %} {% endcomment %}
|
||||
{% for cid in cids %}
|
||||
{% with by_question|get_item:question|get_item:cid as ans_score %}
|
||||
<td class="sbas-ans user-answer-score-{{ans_score.1}}" title="answer score: {{ans_score.1}}">{{ans_score.0}}</td>
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr>
|
||||
<td>Score:</td>
|
||||
{% for cid in cids %}
|
||||
<td>{{user_scores|get_item:cid}}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ urlpatterns = [
|
||||
path("exam/<int:pk>/", views.GenericExamViews.exam_overview, name="exam_overview"),
|
||||
path(
|
||||
"exam/<int:pk>/scores",
|
||||
cache_page(60 * 1)(views.exam_scores_cid),
|
||||
views.GenericExamViews.exam_scores_cid,
|
||||
name="exam_scores_cid",
|
||||
),
|
||||
path(
|
||||
|
||||
+1
-1
@@ -383,7 +383,7 @@ def loadJsonAnswer(answer):
|
||||
|
||||
|
||||
GenericExamViews = ExamViews(
|
||||
Exam, Question, CidUserAnswer, "sbas", "sbas", loadJsonAnswer
|
||||
Exam, Question, None, CidUserAnswer, "sbas", "sbas", loadJsonAnswer
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user