summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authoradityacp2018-02-20 12:04:05 +0530
committeradityacp2018-02-20 12:04:05 +0530
commit2a46206abfd04509707f7bf21a9f6dbc1b2b6b82 (patch)
treec3385f10813df5bfbff612457e08c0045bbc64a9 /yaksh/views.py
parentd183f9882e43b650ed5d189cf451f0210135e2f4 (diff)
parent438f8657021981fc7b2e5adbacc13eb332a2e6d3 (diff)
downloadonline_test-2a46206abfd04509707f7bf21a9f6dbc1b2b6b82.tar.gz
online_test-2a46206abfd04509707f7bf21a9f6dbc1b2b6b82.tar.bz2
online_test-2a46206abfd04509707f7bf21a9f6dbc1b2b6b82.zip
Update to latest changes
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 1055bda..62a448c 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -476,6 +476,10 @@ def start(request, questionpaper_id=None, attempt_num=None, course_id=None,
learning_module = course.learning_module.get(id=module_id)
learning_unit = learning_module.learning_unit.get(quiz=quest_paper.quiz.id)
+ # unit module active status
+ if not learning_module.active:
+ return view_module(request, module_id, course_id)
+
# unit module prerequiste check
if learning_module.has_prerequisite():
if not learning_module.is_prerequisite_passed(user, course):
@@ -1393,7 +1397,8 @@ def design_questionpaper(request, quiz_id, questionpaper_id=None,
'questions': questions,
'fixed_questions': fixed_questions,
'state': state,
- 'random_sets': random_sets
+ 'random_sets': random_sets,
+ 'course_id': course_id
}
return my_render_to_response(
'yaksh/design_questionpaper.html',
@@ -2358,6 +2363,13 @@ def show_lesson(request, lesson_id, module_id, course_id):
learn_module = course.learning_module.get(id=module_id)
learn_unit = learn_module.learning_unit.get(lesson_id=lesson_id)
learning_units = learn_module.get_learning_units()
+
+ if not learn_module.active:
+ return view_module(request, module_id, course_id)
+
+ if not learn_unit.lesson.active:
+ msg = "{0} is not active".format(learn_unit.lesson.name)
+ return view_module(request, module_id, course_id, msg)
if learn_module.has_prerequisite():
if not learn_module.is_prerequisite_passed(user, course):
msg = "You have not completed the module previous to {0}".format(
@@ -2670,6 +2682,10 @@ def view_module(request, module_id, course_id, msg=None):
msg = "{0} is either expired or not active".format(course.name)
return course_modules(request, course_id, msg)
learning_module = course.learning_module.get(id=module_id)
+
+ if not learning_module.active:
+ msg = "{0} is not active".format(learning_module.name)
+ return course_modules(request, course_id, msg)
all_modules = course.get_learning_modules()
if learning_module.has_prerequisite():
if not learning_module.is_prerequisite_passed(user, course):