This commit is contained in:
Ross
2021-10-18 17:37:40 +01:00
parent 65d83e137d
commit 44f266433f
+7 -2
View File
@@ -355,7 +355,7 @@ class Exam(ExamBase):
related_name="anatomy_exam_author",
)
def get_exam_json(self):
def get_exam_json(self, based=True):
questions = self.exam_questions.all()
exam_questions = defaultdict(dict)
@@ -365,10 +365,15 @@ class Exam(ExamBase):
for q in questions:
exam_order.append(q.id)
if based:
image = image_as_base64(q.image)
else:
image = q.iamge.url
exam_questions[q.id] = {
"title": q.get_title(),
"question": str(q.question_type),
"images": [image_as_base64(q.image)],
"images": [image],
"annotations": [str(q.image_annotations)],
"type": "anatomy",
}