diff options
author | ankitjavalkar | 2017-07-27 16:04:57 +0530 |
---|---|---|
committer | ankitjavalkar | 2017-08-28 16:15:30 +0530 |
commit | c57a1f81ca6fef8368bf2e4ebb74d3422c6a1024 (patch) | |
tree | fa255440904d510d1be555d1136b92f6d2a1a25d | |
parent | 9e0f737c25a5156aa884d27357af0aef1145c4b7 (diff) | |
download | online_test-c57a1f81ca6fef8368bf2e4ebb74d3422c6a1024.tar.gz online_test-c57a1f81ca6fef8368bf2e4ebb74d3422c6a1024.tar.bz2 online_test-c57a1f81ca6fef8368bf2e4ebb74d3422c6a1024.zip |
Fix bug: Prevent students from attempting pre-enrolled deactivated courses
-rw-r--r-- | yaksh/templates/yaksh/quizzes_user.html | 11 | ||||
-rw-r--r-- | yaksh/views.py | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/yaksh/templates/yaksh/quizzes_user.html b/yaksh/templates/yaksh/quizzes_user.html index 90d7f8e..b90db18 100644 --- a/yaksh/templates/yaksh/quizzes_user.html +++ b/yaksh/templates/yaksh/quizzes_user.html @@ -28,8 +28,9 @@ No Courses to display <div class="col-md-4"> <h4><b><u> {{ course.name }} by {{ course.creator.get_full_name }}</u></b></h4> </div> - <div class="col-md-4"> - {% if course.hidden %}<span class="label label-info">Open Course</span> + <div class="col-md-4"> + {% if not course.active %} + <span class="label label-danger">Closed</span> {% endif %} {% if user in course.requests.all %} <span class="label label-warning">Request Pending </span> {% elif user in course.rejected.all %}<span class="label label-danger">Request Rejected</span> @@ -45,8 +46,8 @@ No Courses to display <span class="label label-danger">Enrollment Closed</span> {% endif %} {% endif %} - </div> - </div> + </div> + </div> <div class="row"> {% if user in course.students.all %} @@ -57,7 +58,7 @@ No Courses to display {% for quiz in course.get_quizzes %} {% if quiz.active and quiz.course_id == course.id %} <tr> - {% if not quiz.is_expired %} + {% if not quiz.is_expired and course.active %} <td> <a href="{{ URL_ROOT }}/exam/start/{{quiz.questionpaper_set.get.id}}">{{ quiz.description }}</a><br> </td> diff --git a/yaksh/views.py b/yaksh/views.py index 3c7df4d..9f53548 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -375,7 +375,7 @@ def start(request, questionpaper_id=None, attempt_num=None): if not quest_paper.quiz.course.is_enrolled(user): raise Http404('You are not allowed to view this page!') # prerequisite check and passing criteria - if quest_paper.quiz.is_expired(): + if quest_paper.quiz.is_expired() and not quest_paper.quiz.course.active: if is_moderator(user): return redirect("/exam/manage") return redirect("/exam/quizzes") |