.
This commit is contained in:
+41
-8
@@ -417,6 +417,36 @@ class Exam(ExamBase):
|
||||
default=4500,
|
||||
)
|
||||
|
||||
def get_exam_question_json(self, n):
|
||||
q = self.exam_questions.all()[n]
|
||||
|
||||
#exam_order.append(q.id)
|
||||
|
||||
# Loop through longimage associations
|
||||
images = []
|
||||
image_titles = []
|
||||
for series in q.series.all():
|
||||
image_array = []
|
||||
for i in series.images.all():
|
||||
image_array.append(image_as_base64(i.image))
|
||||
#image_array.append(i.image.url)
|
||||
images.append(image_array)
|
||||
image_titles.append(series.get_examination())
|
||||
|
||||
|
||||
|
||||
exam_question = {
|
||||
"title": q.history,
|
||||
"images": images,
|
||||
"image_titles": image_titles,
|
||||
#"feedback_image": [],
|
||||
#"annotations": [str(q.image_annotations)],
|
||||
"type": "long",
|
||||
}
|
||||
|
||||
return exam_question
|
||||
|
||||
|
||||
def get_exam_json(self):
|
||||
questions = self.exam_questions.all()
|
||||
|
||||
@@ -424,6 +454,7 @@ class Exam(ExamBase):
|
||||
|
||||
exam_order = []
|
||||
|
||||
n = 1
|
||||
for q in questions:
|
||||
exam_order.append(q.id)
|
||||
|
||||
@@ -439,15 +470,16 @@ class Exam(ExamBase):
|
||||
image_titles.append(series.get_examination())
|
||||
|
||||
|
||||
exam_questions[q.id] = n
|
||||
|
||||
exam_questions[q.id] = {
|
||||
"title": q.history,
|
||||
"images": images,
|
||||
"image_titles": image_titles,
|
||||
#"feedback_image": [],
|
||||
#"annotations": [str(q.image_annotations)],
|
||||
"type": "long",
|
||||
}
|
||||
#exam_questions[q.id] = {
|
||||
# "title": q.history,
|
||||
# "images": images,
|
||||
# "image_titles": image_titles,
|
||||
# #"feedback_image": [],
|
||||
# #"annotations": [str(q.image_annotations)],
|
||||
# "type": "long",
|
||||
#}
|
||||
|
||||
#if feedback_images:
|
||||
# exam_questions[q.id]["feedback_image"] = feedback_images
|
||||
@@ -461,6 +493,7 @@ class Exam(ExamBase):
|
||||
"exam_mode": True,
|
||||
"exam_order": exam_order,
|
||||
"questions": exam_questions,
|
||||
"question_requests": True,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ urlpatterns = [
|
||||
path("exam/", views.LongExamViews.exam_list, name="exam_list"),
|
||||
path("exam/json/", views.LongExamViews.active_exams, name="active_exams"),
|
||||
path("exam/json/<int:pk>", views.LongExamViews.exam_json, name="exam_json"),
|
||||
path("exam/json/<int:pk>/<int:sk", views.LongExamViews.exam_question_json, name="exam_question_json"),
|
||||
path(
|
||||
"exam/json/<int:pk>/recreate",
|
||||
views.LongExamViews.exam_json_recreate,
|
||||
|
||||
Reference in New Issue
Block a user