summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2018-02-15 19:28:53 +0530
committerGitHub2018-02-15 19:28:53 +0530
commit3e4fa8a4b6f0b16731f27b724fad119ee74dc618 (patch)
tree7e326dcfa3897f624c8c3cf637543646b86b7491 /yaksh/views.py
parent7a89ac6dabe7d2b8d914c8efde30c65f365bd771 (diff)
parent617d09ca9b05185d9a2310c106360091ed8a1b1a (diff)
downloadonline_test-3e4fa8a4b6f0b16731f27b724fad119ee74dc618.tar.gz
online_test-3e4fa8a4b6f0b16731f27b724fad119ee74dc618.tar.bz2
online_test-3e4fa8a4b6f0b16731f27b724fad119ee74dc618.zip
Merge pull request #436 from adityacp/fixes_lesson_feature
Additions and fixes for lesson feature
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 2bc5dfe..011b417 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -475,6 +475,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):
@@ -1392,7 +1396,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',
@@ -2348,6 +2353,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(
@@ -2660,6 +2672,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):