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
+11 -1
View File
@@ -158,6 +158,16 @@ class AnatomyQuestion(models.Model):
return reverse("anatomy:question_detail", kwargs={"pk": self.pk})
def get_primary_answer(self):
ans = self.answers.filter(
proposed=False, status=Answer.MarkOptions.CORRECT
).first()
# ans = self.answers.first()
if ans is None:
return "None yet..."
else:
return ans.answer
if (
self.answers.filter(
proposed=False, status=Answer.MarkOptions.CORRECT
@@ -434,7 +444,7 @@ class CidUserAnswer(models.Model):
max_length=1,
choices=Answer.MarkOptions.choices,
default=Answer.MarkOptions.UNMARKED,
blank=True
blank=True,
)
def __str__(self):
+1 -1
View File
@@ -33,7 +33,7 @@
{% endif %}
<ol id="full-question-list" class="sortable">
{% for question in questions.all %}
{% for question in questions %}
<li data-question_pk={{question.pk}}>
<span class="flex-col">
@@ -57,14 +57,14 @@
{% for question in questions %}
<tr>
<td><a href="{% url 'anatomy:mark' exam_pk=exam.pk sk=forloop.counter0 %}">Question {{forloop.counter}}</a>
{% if question.normal %}
[N]
{% else %}
[A]
{% endif %}
</td>
{% for cid in cids %}
{% comment %} {% for cid in cids %}
<td class="anatomy-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="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
@@ -1004,7 +1004,7 @@ def question_save_annotation(request, pk):
GenericExamViews = ExamViews(
Exam, AnatomyQuestion, CidUserAnswer, "anatomy", "anatomy", loadJsonAnswer
Exam, AnatomyQuestion, Answer, CidUserAnswer, "anatomy", "anatomy", loadJsonAnswer
)