.
This commit is contained in:
+39
-10
@@ -446,15 +446,16 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
"region",
|
||||
"examination",
|
||||
"question_type",
|
||||
).all()
|
||||
# .prefetch_related(
|
||||
# Prefetch(
|
||||
# "answers",
|
||||
# queryset=self.Answer.objects.filter(
|
||||
# proposed=False, status=self.Answer.MarkOptions.CORRECT
|
||||
# ),
|
||||
# )
|
||||
# )
|
||||
)
|
||||
.all()
|
||||
.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(),
|
||||
),
|
||||
)
|
||||
)
|
||||
elif self.app_name == "rapids":
|
||||
questions = (
|
||||
@@ -622,7 +623,35 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
if not self.check_user_access(request.user, pk):
|
||||
raise PermissionDenied
|
||||
|
||||
questions = exam.exam_questions.all()
|
||||
if self.app_name == "anatomy":
|
||||
questions = (
|
||||
exam.exam_questions.select_related(
|
||||
"modality",
|
||||
"structure",
|
||||
"body_part",
|
||||
"region",
|
||||
"examination",
|
||||
"question_type",
|
||||
)
|
||||
.all()
|
||||
.prefetch_related(
|
||||
#"cid_user_answers",
|
||||
Prefetch(
|
||||
"answers",
|
||||
queryset=self.Answer.objects.filter(proposed=False, status=self.Answer.MarkOptions.CORRECT),
|
||||
to_attr="prefetched_primary_answer"
|
||||
#queryset=self.Answer.objects.filter(),
|
||||
),
|
||||
Prefetch(
|
||||
"cid_user_answers",
|
||||
queryset=self.CidUserAnswer.objects.filter(score=self.Answer.MarkOptions.UNMARKED, exam__id=pk),
|
||||
to_attr="prefetched_unmarked_cid_answers"
|
||||
#queryset=self.Answer.objects.filter(),
|
||||
),
|
||||
)
|
||||
)
|
||||
else:
|
||||
questions = exam.exam_questions.all()
|
||||
|
||||
# Handle exams that require double marking
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user