.
This commit is contained in:
+19
-4
@@ -429,8 +429,7 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
# exam.get_exam_json()
|
||||
|
||||
# TODO: check if mememory leak?
|
||||
t = threading.Thread(target=self.exam_json,
|
||||
args=(request, pk))
|
||||
t = threading.Thread(target=self.exam_json, args=(request, pk))
|
||||
t.setDaemon(True)
|
||||
t.start()
|
||||
|
||||
@@ -520,10 +519,26 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
)
|
||||
elif self.app_name == "rapids":
|
||||
questions = (
|
||||
exam.exam_questions.select_related()
|
||||
exam.exam_questions.select_related(
|
||||
"images", "abnormality", "region", "examination"
|
||||
)
|
||||
.all()
|
||||
.prefetch_related("images", "abnormality", "region", "examination")
|
||||
.prefetch_related(
|
||||
Prefetch(
|
||||
"answers",
|
||||
queryset=self.Answer.objects.filter(
|
||||
proposed=False, status=self.Answer.MarkOptions.CORRECT
|
||||
),
|
||||
to_attr="prefetched_primary_answer"
|
||||
# queryset=self.Answer.objects.filter(),
|
||||
),
|
||||
)
|
||||
)
|
||||
# questions = (
|
||||
# exam.exam_questions.select_related()
|
||||
# .all()
|
||||
# .prefetch_related("images", "abnormality", "region", "examination")
|
||||
# )
|
||||
elif self.app_name == "physics":
|
||||
questions = (
|
||||
exam.exam_questions.select_related("category").all()
|
||||
|
||||
Reference in New Issue
Block a user