diff options
-rw-r--r-- | yaksh/models.py | 6 | ||||
-rw-r--r-- | yaksh/test_models.py | 34 | ||||
-rw-r--r-- | yaksh/views.py | 9 |
3 files changed, 29 insertions, 20 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index f9dda45..1e96ae1 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -720,8 +720,10 @@ class LearningModule(models.Model): learning_units_with_quiz = self.learning_unit.filter(type='quiz') ordered_units = learning_units_with_quiz.order_by("order") - statuses = [unit.quiz.get_answerpaper_passing_status(user, course) - for unit in ordered_units] + statuses = [ + unit.quiz.get_answerpaper_passing_status(user, course) + for unit in ordered_units + ] if not statuses: status = False diff --git a/yaksh/test_models.py b/yaksh/test_models.py index d4e0141..1adf64a 100644 --- a/yaksh/test_models.py +++ b/yaksh/test_models.py @@ -153,25 +153,35 @@ class LearningModuleTestCases(unittest.TestCase): self.course_status = CourseStatus.objects.get( course=self.course, user=self.student) - self.prereq_course = Course.objects.create(name="Prerequisite Course", - enrollment="Enroll Request", creator=self.creator) - + self.prereq_course = Course.objects.create( + name="Prerequisite Course", + enrollment="Enroll Request", creator=self.creator + ) self.prereq_learning_module = LearningModule.objects.create( name='LM3', description='module one', creator=self.creator - ) + ) self.test_learning_module = LearningModule.objects.create( - name='LM4', description='module two', creator=self.creator, order=1 - ) + name='LM4', description='module two', + creator=self.creator, order=1 + ) course_status = CourseStatus.objects.create( course=self.prereq_course, user=self.student ) - lesson = Lesson.objects.create(name='P1', description='Video Lesson', - creator=self.creator) - learning_unit_lesson = LearningUnit.objects.create(order=2, lesson=lesson, - type='lesson') - learning_unit_quiz = LearningUnit.objects.create(order=1, quiz=self.quiz, - type='quiz') + lesson = Lesson.objects.create( + name='P1', description='Video Lesson', + creator=self.creator + ) + learning_unit_lesson = LearningUnit.objects.create( + order=2, + lesson=lesson, + type='lesson' + ) + learning_unit_quiz = LearningUnit.objects.create( + order=1, + quiz=self.quiz, + type='quiz' + ) self.prereq_learning_module.learning_unit.add(learning_unit_quiz) self.prereq_learning_module.learning_unit.add(learning_unit_lesson) self.prereq_learning_module.save() diff --git a/yaksh/views.py b/yaksh/views.py index 79fb537..526c774 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -480,8 +480,7 @@ def start(request, questionpaper_id=None, attempt_num=None, course_id=None, if not learning_module.is_prerequisite_passed(user, course): msg = ( "You have not successfully passed the module" - " previous to {0}".format( - learning_module.name) + " previous to {0}".format(learning_module.name) ) return course_modules(request, course_id, msg) @@ -2441,8 +2440,7 @@ def show_lesson(request, lesson_id, module_id, course_id): if not learn_module.is_prerequisite_passed(user, course): msg = ( "You have not successfully passed the module" - " previous to {0}".format( - learn_module.name) + " previous to {0}".format(learn_module.name) ) return view_module(request, module_id, course_id, msg) @@ -2767,8 +2765,7 @@ def view_module(request, module_id, course_id, msg=None): if not learning_module.is_prerequisite_passed(user, course): msg = ( "You have not successfully passed the module" - " previous to {0}".format( - learning_module.name) + " previous to {0}".format(learning_module.name) ) return course_modules(request, course_id, msg) |