summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2020-05-18 10:19:52 +0530
committerGitHub2020-05-18 10:19:52 +0530
commita72bd55bb9ba72b42ffd41b16c999321421e3224 (patch)
treef28a2300f03a3833b830e6968316ac99b8ecab64 /yaksh/models.py
parentb264b673a2f84def1b9736a7a596b1acd5bb4d72 (diff)
parentf8ce9e4e896231ae6f5c0193b76afd360d3bf1ea (diff)
downloadonline_test-a72bd55bb9ba72b42ffd41b16c999321421e3224.tar.gz
online_test-a72bd55bb9ba72b42ffd41b16c999321421e3224.tar.bz2
online_test-a72bd55bb9ba72b42ffd41b16c999321421e3224.zip
Merge pull request #705 from CruiseDevice/test_start_view_func
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