.
This commit is contained in:
+9
-3
@@ -1,3 +1,4 @@
|
||||
from __future__ import annotations
|
||||
import json
|
||||
from django.contrib.contenttypes.fields import GenericRelation
|
||||
from django.db import models
|
||||
@@ -256,7 +257,7 @@ class AnatomyQuestion(models.Model):
|
||||
]
|
||||
)
|
||||
|
||||
def get_question_json(self, based=True, feedback=False):
|
||||
def get_question_json(self, based=True, feedback=False, answers=True):
|
||||
"""Returns a json representation of the question"""
|
||||
|
||||
# Loop through rapidimage associations
|
||||
@@ -281,7 +282,8 @@ class AnatomyQuestion(models.Model):
|
||||
"question": str(self.question_type),
|
||||
}
|
||||
|
||||
json["answers"] = list(self.get_correct_unstripped_answers())
|
||||
if answers:
|
||||
json["answers"] = list(self.get_correct_unstripped_answers())
|
||||
|
||||
return json
|
||||
|
||||
@@ -420,11 +422,15 @@ class Exam(ExamBase):
|
||||
else:
|
||||
image = q.image.url
|
||||
|
||||
annotations = []
|
||||
if str(q.image_annotations):
|
||||
annotations = [str(q.image_annotations)]
|
||||
|
||||
exam_questions[q.id] = {
|
||||
"title": q.get_title(),
|
||||
"question": str(q.question_type),
|
||||
"images": [image],
|
||||
"annotations": [str(q.image_annotations)],
|
||||
"annotations": annotations,
|
||||
"type": "anatomy",
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user