From 42b1a72a4a8f88358ebda1bfd898e76f61df1a06 Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 8 Feb 2021 11:59:08 +0000 Subject: [PATCH] . --- longs/models.py | 18 +++++++----------- rapids/models.py | 6 +++--- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/longs/models.py b/longs/models.py index b68439a6..5468ed4b 100644 --- a/longs/models.py +++ b/longs/models.py @@ -306,7 +306,7 @@ class Exam(ExamBase): ) def get_exam_json(self): - questions = exam.exam_questions.all() + questions = self.exam_questions.all() exam_questions = defaultdict(dict) @@ -317,14 +317,10 @@ class Exam(ExamBase): # Loop through longimage associations images = [] - feedback_images = [] - for i in q.images.all(): - if i.feedback_image == True: - feedback_images.append(image_as_base64(i.image)) - # feedback_images.append(i.image.url) - else: - images.append(image_as_base64(i.image)) - #images.append(i.image.url) + for series in q.series: + for i in series.images.all(): + #images.append(image_as_base64(i.image)) + images.append(i.image.url) @@ -343,7 +339,7 @@ class Exam(ExamBase): "eid": "long/{}".format(exam.id), "cached": False, "exam_type": "long", - "exam_name": exam.name, + "exam_name": self.name, "exam_mode": True, "exam_order": exam_order, "questions": exam_questions, @@ -351,7 +347,7 @@ class Exam(ExamBase): if exam.time_limit: - exam_json["exam_time"] = exam.time_limit + exam_json["exam_time"] = self.time_limit return exam_json diff --git a/rapids/models.py b/rapids/models.py index 90656cb9..a0ce3e0d 100644 --- a/rapids/models.py +++ b/rapids/models.py @@ -387,17 +387,17 @@ class Exam(ExamBase): exam_json = { - "eid": "rapid/{}".format(exam.id), + "eid": "rapid/{}".format(self.id), "cached": False, "exam_type": "rapid", - "exam_name": exam.name, + "exam_name": self.name, "exam_mode": True, "exam_order": exam_order, "questions": exam_questions, } if exam.time_limit: - exam_json["exam_time"] = exam.time_limit + exam_json["exam_time"] = self.time_limit return