summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authoradityacp2020-03-31 14:46:19 +0530
committeradityacp2020-03-31 14:46:19 +0530
commit541f3ec154f7c484a2a9105565117cefa4e15b18 (patch)
tree38d3a54689f3c03b8c1eb55789bf61893aff9a44 /yaksh/models.py
parent8007fa364ce894a879f72d72c104e7fe49e7154f (diff)
downloadonline_test-541f3ec154f7c484a2a9105565117cefa4e15b18.tar.gz
online_test-541f3ec154f7c484a2a9105565117cefa4e15b18.tar.bz2
online_test-541f3ec154f7c484a2a9105565117cefa4e15b18.zip
Update the units and modules order on creation
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 12c902b..52a0414 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -841,6 +841,15 @@ class LearningModule(models.Model):
write_templates_to_zip(zip_file, module_file_path, module_data,
module_name, folder_name)
+ def get_unit_order(self, type, unit):
+ if type == "lesson":
+ order = self.get_learning_units().get(
+ type=type, lesson=unit).order
+ else:
+ order = self.get_learning_units().get(
+ type=type, quiz=unit).order
+ return order
+
def __str__(self):
return self.name