summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authorCruiseDevice2020-05-12 21:20:17 +0530
committerCruiseDevice2020-05-12 21:20:17 +0530
commit8d8e9beb56e203a6a01ea227e30e36998361dba0 (patch)
treeebdf52fd1d318d30bd9de6aac6fc0e574bd0e790 /yaksh/models.py
parent833b96ac49499810934ada8ba02750623455d0cd (diff)
downloadonline_test-8d8e9beb56e203a6a01ea227e30e36998361dba0.tar.gz
online_test-8d8e9beb56e203a6a01ea227e30e36998361dba0.tar.bz2
online_test-8d8e9beb56e203a6a01ea227e30e36998361dba0.zip
Add testcases for start view function
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 64489b8..b64ac77 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -773,14 +773,20 @@ class LearningModule(models.Model):
def get_passing_status(self, user, course):
course_status = CourseStatus.objects.filter(user=user, course=course)
+ ordered_units = []
if course_status.exists():
- learning_units_with_quiz = self.learning_unit.filter(type='quiz')
+ learning_units_with_quiz = self.learning_unit.filter(
+ type='quiz'
+ ).order_by("order")
ordered_units = learning_units_with_quiz.order_by("order")
- statuses = [
- unit.quiz.get_answerpaper_passing_status(user, course)
- for unit in ordered_units
- ]
+ if ordered_units:
+ statuses = [
+ unit.quiz.get_answerpaper_passing_status(user, course)
+ for unit in ordered_units
+ ]
+ else:
+ statuses = []
if not statuses:
status = False