This commit is contained in:
Ross
2021-12-19 13:09:55 +00:00
parent 07dbdfe0e4
commit fccf25e2a1
16 changed files with 256 additions and 37 deletions
+6 -1
View File
@@ -658,7 +658,7 @@ class CidUserAnswer(models.Model):
max_length=1,
choices=Answer.MarkOptions.choices,
default=Answer.MarkOptions.UNMARKED,
blank=True
blank=True,
)
def __str__(self):
@@ -700,6 +700,7 @@ class CidUserAnswer(models.Model):
def get_answer_score(self, cached=True):
if cached and self.score:
print("CACHED")
if self.score == Answer.MarkOptions.CORRECT:
mark = 2
elif self.score == Answer.MarkOptions.HALF_MARK:
@@ -708,6 +709,7 @@ class CidUserAnswer(models.Model):
mark = 0
return mark
print("NOT CACHED")
q = self.question
@@ -731,6 +733,9 @@ class CidUserAnswer(models.Model):
mark = "unmarked"
if marked_ans is not None:
self.score = marked_ans.status
self.save()
if marked_ans.status == Answer.MarkOptions.CORRECT:
mark = 2
elif marked_ans.status == Answer.MarkOptions.HALF_MARK:
+8 -5
View File
@@ -31,11 +31,11 @@
<th>Score</th>
<th>Normalised Score</th>
</tr>
{% for user, value in user_answers_marks.items %}
{% for cid in cids %}
<tr>
<td><a href="{% url 'cid_scores_admin' user %}">{{user}}</a></td>
<td>{{user_scores|get_item:user}}</td>
<td>{{user_scores_normalised|get_item:user}}</td>
<td><a href="{% url 'cid_scores_admin' cid %}">{{cid}}</a></td>
<td>{{user_scores|get_item:cid}}</td>
<td>{{user_scores_normalised|get_item:cid}}</td>
</tr>
{% endfor %}
</table>
@@ -63,7 +63,10 @@
{% endif %}
</td>
{% for cid in cids %}
<td class="rapid-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>
{% comment %} <td class="rapid-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> {% endcomment %}
{% with by_question|get_item:question|get_item:cid as ans_score %}
<td class="anatomy-ans user-answer-score-{{ans_score.1}}" title="answer score: {{ans_score.1}}">{{ans_score.0}}</td>
{% endwith %}
{% endfor %}
</tr>
{% endfor %}
+1 -1
View File
@@ -1048,7 +1048,7 @@ class QuestionDelete(AuthorOrCheckerRequiredMixin, DeleteView):
GenericExamViews = ExamViews(
Exam, Rapid, CidUserAnswer, "rapids", "rapid", loadJsonAnswer
Exam, Rapid, Answer, CidUserAnswer, "rapids", "rapid", loadJsonAnswer
)