diff options
-rw-r--r-- | yaksh/models.py | 20 | ||||
-rw-r--r-- | yaksh/templates/yaksh/add_quiz.html | 12 | ||||
-rw-r--r-- | yaksh/templates/yaksh/question.html | 4 | ||||
-rw-r--r-- | yaksh/templates/yaksh/statistics_question.html | 24 | ||||
-rw-r--r-- | yaksh/views.py | 2 |
5 files changed, 32 insertions, 30 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 6542daa..32632dd 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -1695,17 +1695,15 @@ class QuestionPaperManager(models.Manager): def create_trial_paper_to_test_quiz(self, trial_quiz, original_quiz_id): """Creates a trial question paper to test quiz.""" - if self.filter(quiz=trial_quiz).exists(): - trial_questionpaper = self.get(quiz=trial_quiz) - else: - trial_questionpaper, trial_questions = \ - self._create_trial_from_questionpaper(original_quiz_id) - trial_questionpaper.quiz = trial_quiz - trial_questionpaper.fixed_questions\ - .add(*trial_questions["fixed_questions"]) - trial_questionpaper.random_questions\ - .add(*trial_questions["random_questions"]) - trial_questionpaper.save() + trial_quiz.questionpaper_set.all().delete() + trial_questionpaper, trial_questions = \ + self._create_trial_from_questionpaper(original_quiz_id) + trial_questionpaper.quiz = trial_quiz + trial_questionpaper.fixed_questions\ + .add(*trial_questions["fixed_questions"]) + trial_questionpaper.random_questions\ + .add(*trial_questions["random_questions"]) + trial_questionpaper.save() return trial_questionpaper diff --git a/yaksh/templates/yaksh/add_quiz.html b/yaksh/templates/yaksh/add_quiz.html index 55e3bd6..9b80e0d 100644 --- a/yaksh/templates/yaksh/add_quiz.html +++ b/yaksh/templates/yaksh/add_quiz.html @@ -55,7 +55,7 @@ {% if quiz and course_id %} {% if quiz.questionpaper_set.get.id %} <center> - <a href="{% url 'yaksh:designquestionpaper' quiz.id quiz.questionpaper_set.get.id course_id %}" class="btn btn-primary"> + <a href="{% url 'yaksh:designquestionpaper' course_id quiz.id quiz.questionpaper_set.get.id %}" class="btn btn-primary"> <i class="fa fa-edit"></i> Edit Question Paper </a> <a href="{% url 'yaksh:preview_questionpaper' quiz.questionpaper_set.get.id %}" class="btn btn-info" target="_blank"> @@ -65,11 +65,11 @@ <br> <h4>You can check the quiz by attempting it in the following modes:</h4> <a class="btn btn-outline-info" name="button" href="{% url 'yaksh:test_quiz' 'usermode' quiz.id course_id %}" target="blank"> - User Mode + Try as student </a> - <a class="btn btn-outline-info" name="button" href="{% url 'yaksh:test_quiz' 'godmode' quiz.id course_id %}" target="blank"> - God Mode + <a class="btn btn-outline-primary" name="button" href="{% url 'yaksh:test_quiz' 'godmode' quiz.id course_id %}" target="blank"> + Try as teacher </a> <a data-toggle="modal" data-target="#help"> <span class="text-info"><i class="fa fa-info-circle"></i> Help</span></a> @@ -88,13 +88,13 @@ </div> <div class="modal-body"> <p> - <b>User Mode:</b> Attempt quiz the way normal users will attempt i.e. - + <b>Try as student:</b> Attempt quiz the way students will attempt i.e. - <ul class="list-group list-group-flush"> <li class="list-group-item">Quiz will have the same duration as that of the original quiz.</li> <li class="list-group-item">Quiz won't start if the course is inactive or the quiz time has expired.</li> <li class="list-group-item">You will be notified about quiz prerequisites.(You can still attempt the quiz though)</li> </ul> - <b>God Mode:</b> Attempt quiz without any time or eligibilty constraints. + <b>Try as teacher:</b> Attempt quiz without any time or eligibilty constraints. </p> </div> </div> diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index ae2f9f4..6489b38 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -127,14 +127,14 @@ question_type = "{{ question.type }}"; <button type="button" class="close" data-dismiss="alert"> <i class="fa fa-close"></i> </button> - <strong>Note:</strong> {{ notification }} + {{ notification }} </div> {% else %} <div id="notification" class="alert alert-info col-md-8" role="alert"> <button type="button" class="close" data-dismiss="alert"> <i class="fa fa-close"></i> </button> - <strong>Note:</strong> {{ notification }} + {{ notification }} </div> {% endif %} {% else %} diff --git a/yaksh/templates/yaksh/statistics_question.html b/yaksh/templates/yaksh/statistics_question.html index 9a54501..52c29d3 100644 --- a/yaksh/templates/yaksh/statistics_question.html +++ b/yaksh/templates/yaksh/statistics_question.html @@ -1,9 +1,10 @@ {% extends "manage.html" %} +{% block title %} Question Statistics {% endblock %} {% block pagetitle %} Statistics for {{ quiz.description }}{% endblock pagetitle %} {% block content %} -<div class="container"> +<div class="container-fluid"> <div class="row"> <div class="col-md-2"> <ul class="list-group"> @@ -18,16 +19,14 @@ <div class="col-md-9"> {% if question_stats %} <p><b>Total number of participants: {{ total }}</b></p> - <table class="table table-bordered table-responsive-sm"> - <tr class="bg-light yakshred"><th>Question</th><th>Type</th><th>Total</th><th>Answered Correctly</th></tr> + <table class="table table-responsive-sm"> + <tr class="bg-light yakshred"><th>Question</th><th></th><th>Type</th><th>Total</th><th>Answered Correctly</th></tr> {% for question, value in question_stats.items %} <tr> - <td>{{ question.summary }} - <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapse_question_{{question.id}}" aria-expanded="false" aria-controls="collapseExample"> - More - </button> + <td width="45%">{{ question.summary }} <div class="collapse" id="collapse_question_{{question.id}}"> - <div class="card card-body" style="width: 18rem;"> + <br> + <div class="card card-body"> <strong> Summary: </strong> @@ -38,7 +37,7 @@ Description: </strong> <p> - {{ question.description }} + {{ question.description|safe }} </p> <strong> Points: @@ -50,7 +49,7 @@ Type: </strong> <p> - {{ question.type }} + {{ question.get_type_display }} </p> {% if question.type in 'mcq mcc' %} <strong> @@ -72,6 +71,11 @@ </div> </div> </td> + <td> + <button class="btn btn-outline-primary" type="button" data-toggle="collapse" data-target="#collapse_question_{{question.id}}" aria-expanded="false" aria-controls="collapseExample"> + <i class="fa fa-angle-down"></i> More + </button> + </td> <td>{{ question.type }}</td> <td>{{value.1}}</td><td>{{ value.0 }} ({% widthratio value.0 value.1 100 %}%)</td> diff --git a/yaksh/views.py b/yaksh/views.py index 15ebd03..c1798b5 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -821,7 +821,7 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None, previous_question=current_question) else: user_answer = request.POST.get('answer') - if not user_answer: + if not str(user_answer): msg = "Please submit a valid answer." return show_question( request, current_question, paper, notification=msg, |