diff options
author | adityacp | 2018-06-07 15:27:57 +0530 |
---|---|---|
committer | adityacp | 2018-06-07 15:27:57 +0530 |
commit | 93bb10eae5e1364ae6492f2534f0e7864c9c4254 (patch) | |
tree | fede3f4250f3711d31da4bb7edd262edd0a90727 /yaksh/views.py | |
parent | d26ff2db941355b40b395992338e02975abfd90d (diff) | |
download | online_test-93bb10eae5e1364ae6492f2534f0e7864c9c4254.tar.gz online_test-93bb10eae5e1364ae6492f2534f0e7864c9c4254.tar.bz2 online_test-93bb10eae5e1364ae6492f2534f0e7864c9c4254.zip |
Fix test for course status and format error message properly
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 8a0ab90..3341aca 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -2698,8 +2698,10 @@ def course_modules(request, course_id, msg=None): context = {"course": course, "user": user, "msg": msg} course_status = CourseStatus.objects.filter(course=course, user=user) context['course_percentage'] = course.get_completion_percent(user) - context['modules'] = [(module, module.get_module_complete_percent(course, user)) - for module in learning_modules] + context['modules'] = [ + (module, module.get_module_complete_percent(course, user)) + for module in learning_modules + ] if course_status.exists(): course_status = course_status.first() if not course_status.grade: @@ -2778,16 +2780,21 @@ def get_user_data(request, course_id, student_id): data['msg'] = 'You are not a moderator' data['status'] = False elif not course.is_creator(user) and not course.is_teacher(user): - msg = 'You are neither course creator nor course teacher for {0}'.format( - course.name) + msg = dedent( + """\ + You are neither course creator nor course teacher for {0} + """.format(course.name) + ) data['msg'] = msg data['status'] = False else: student = User.objects.get(id=student_id) data['status'] = True modules = course.get_learning_modules() - module_percent = [(module, module.get_module_complete_percent(course, student)) - for module in modules] + module_percent = [ + (module, module.get_module_complete_percent(course, student)) + for module in modules + ] data['modules'] = module_percent _update_course_percent(course, student) data['course_percentage'] = course.get_completion_percent(student) |