diff options
author | ankitjavalkar | 2019-03-25 11:53:26 +0530 |
---|---|---|
committer | ankitjavalkar | 2019-03-25 11:53:26 +0530 |
commit | ef42d19a8884155da24398e7c27aade115a79ade (patch) | |
tree | 0959cfa850d10838a32b353d9cb228a5ec6cd594 /yaksh | |
parent | a69d5f58b70206124a202ca4366bd9c0e6d4f1b6 (diff) | |
download | online_test-ef42d19a8884155da24398e7c27aade115a79ade.tar.gz online_test-ef42d19a8884155da24398e7c27aade115a79ade.tar.bz2 online_test-ef42d19a8884155da24398e7c27aade115a79ade.zip |
Fix PEP8 issues and variable names
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/models.py | 10 | ||||
-rw-r--r-- | yaksh/views.py | 15 |
2 files changed, 17 insertions, 8 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 5f72ecf..7a40fae 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -716,17 +716,17 @@ class LearningModule(models.Model): def get_passing_status(self, user, course): course_status = CourseStatus.objects.filter(user=user, course=course) - state = "failed" if course_status.exists(): - ordered_units = self.learning_unit.filter(type='quiz').order_by("order") + learning_units_with_quiz = self.learning_unit.filter(type='quiz') + ordered_units = learning_units_with_quiz.order_by("order") - status_list = [unit.quiz.get_answerpaper_passing_status(user, course) + statuses = [unit.quiz.get_answerpaper_passing_status(user, course) for unit in ordered_units] - if not status_list: + if not statuses: status = False else: - status = all(status_list) + status = all(statuses) return status def is_prerequisite_passed(self, user, course): diff --git a/yaksh/views.py b/yaksh/views.py index 5009cb6..79fb537 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -478,8 +478,11 @@ def start(request, questionpaper_id=None, attempt_num=None, course_id=None, if learning_module.check_prerequisite_passes: if not learning_module.is_prerequisite_passed(user, course): - msg = "You have not successfully passed the module previous to {0}".format( + msg = ( + "You have not successfully passed the module" + " previous to {0}".format( learning_module.name) + ) return course_modules(request, course_id, msg) # is user enrolled in the course @@ -2436,8 +2439,11 @@ def show_lesson(request, lesson_id, module_id, course_id): return view_module(request, module_id, course_id, msg) if learn_module.check_prerequisite_passes: if not learn_module.is_prerequisite_passed(user, course): - msg = "You have not successfully passed the module previous to {0}".format( + msg = ( + "You have not successfully passed the module" + " previous to {0}".format( learn_module.name) + ) return view_module(request, module_id, course_id, msg) # update course status with current unit @@ -2759,8 +2765,11 @@ def view_module(request, module_id, course_id, msg=None): if learning_module.check_prerequisite_passes: if not learning_module.is_prerequisite_passed(user, course): - msg = "You have not successfully passed the module previous to {0}".format( + msg = ( + "You have not successfully passed the module" + " previous to {0}".format( learning_module.name) + ) return course_modules(request, course_id, msg) learning_units = learning_module.get_learning_units() |