From c661a5c9c5f126b13dc6d7f6726c40c81d1aa60f Mon Sep 17 00:00:00 2001 From: Ross Date: Tue, 2 Mar 2021 20:49:08 +0000 Subject: [PATCH] . --- rapids/models.py | 15 +++++++++++++++ rapids/templates/rapids/exam_overview.html | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/rapids/models.py b/rapids/models.py index 894eac85..63f5efe0 100644 --- a/rapids/models.py +++ b/rapids/models.py @@ -352,6 +352,21 @@ class Exam(ExamBase): help_text="Exam time limit (in seconds). Default is 2100 secondse (35 minutes)", default=2100 ) + def get_normal_abnormal_breakdown(self): + # Inefficient but more extendible + questions = self.exam_questions.all() + + normal = [] + abnormal = [] + for q in question: + if q.normal: + normal.append(q) + else: + abnormal.append(q) + + return len(normal) + + def get_exam_json(self): questions = self.exam_questions.all() diff --git a/rapids/templates/rapids/exam_overview.html b/rapids/templates/rapids/exam_overview.html index b915f176..f20873b8 100644 --- a/rapids/templates/rapids/exam_overview.html +++ b/rapids/templates/rapids/exam_overview.html @@ -6,7 +6,8 @@
Admin Edit

Exam: {{ exam.name }}

- This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds. + This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.
+ Normal {{ exam.get_normal_abnormal_breakdown }}
Exam active: [When checked the exam will be available to take in the test system]