diff options
author | adityacp | 2017-12-14 12:07:52 +0530 |
---|---|---|
committer | adityacp | 2017-12-14 12:07:52 +0530 |
commit | 1063ea69f8ee39e5ba249b24700256383abb61ac (patch) | |
tree | 3bbe9aeafbdbdd0f772f1b428f84b83fb64dfcd3 /yaksh/models.py | |
parent | 8179dd6093bf2500b1b45220a72362a501c55afb (diff) | |
parent | d33e622b8790d81c80eea2305ab7a2989c21b156 (diff) | |
download | online_test-1063ea69f8ee39e5ba249b24700256383abb61ac.tar.gz online_test-1063ea69f8ee39e5ba249b24700256383abb61ac.tar.bz2 online_test-1063ea69f8ee39e5ba249b24700256383abb61ac.zip |
Update to latest changes
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 53c24f6..c65e9ef 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -430,19 +430,15 @@ class LearningModule(models.Model): return added_quiz_lessons def toggle_check_prerequisite(self): - if self.check_prerequisite: - self.check_prerequisite = False - else: - self.check_prerequisite = True + self.check_prerequisite = not self.check_prerequisite def get_next_unit(self, current_unit_id): ordered_units = self.learning_unit.order_by("order") ordered_units_ids = list(ordered_units.values_list("id", flat=True)) current_unit_index = ordered_units_ids.index(current_unit_id) - if current_unit_index + 1 == len(ordered_units_ids): + next_index = current_unit_index + 1 + if next_index == len(ordered_units_ids): next_index = 0 - else: - next_index = current_unit_index + 1 return ordered_units.get(id=ordered_units_ids[next_index]) def get_status(self, user, course): @@ -649,10 +645,10 @@ class Course(models.Model): def get_learning_units(self): learning_modules = self.learning_module.all() - learning_unit_list = [] + learning_units = [] for module in learning_modules: - learning_unit_list.extend(module.get_learning_units()) - return learning_unit_list + learning_units.extend(module.get_learning_units()) + return learning_units def remove_trial_modules(self): learning_modules = self.learning_module.all() |