diff options
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/templates/yaksh/question.html | 19 | ||||
-rw-r--r-- | yaksh/views.py | 4 |
2 files changed, 18 insertions, 5 deletions
diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index f94298e..5b5326d 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -137,9 +137,15 @@ function call_skip(url) {% block main %} <p id="status"></p> {% if notification %} - <div class="alert alert-warning" role="alert"> - <strong>Note:</strong> {{ notification }} - </div> + {% if question.type == "code" %} + <div class="alert alert-success" role="alert"> + <strong>Note:</strong> {{ notification }} + </div> + {% else %} + <div class="alert alert-warning" role="alert"> + <strong>Note:</strong> {{ notification }} + </div> + {% endif %} {% endif %} <form id="code" action="{{URL_ROOT}}/exam/{{ question.id }}/check/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/" method="post" enctype="multipart/form-data"> {% csrf_token %} @@ -204,10 +210,15 @@ function call_skip(url) {% elif question.type == "upload" %} <br><button class="btn btn-primary" type="submit" name="check" id="check" onClick="return validate();">Upload</button> {% else %} - <button class="btn btn-primary" type="submit" name="check" id="check" onClick="submitCode();">Check Answer <span class="glyphicon glyphicon-cog"></span></button> + {% if notification == None %} + <button class="btn btn-primary" type="submit" name="check" id="check" onClick="submitCode();">Check Answer <span class="glyphicon glyphicon-cog"></span></button> + {% endif %} {% endif %} + {% if paper.question_paper.quiz.allow_skip and not paper.get_questions_unanswered|length_is:"1" %} + {% if notification == None %} <button class="btn btn-primary" onclick="call_skip('{{ URL_ROOT }}/exam/{{ question.id }}/skip/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/')" name="skip" id="skip">Attempt Later <span class="glyphicon glyphicon-arrow-right"></span></button> + {% endif %} </div> </div> </div> diff --git a/yaksh/views.py b/yaksh/views.py index 163c12f..1089067 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -413,7 +413,9 @@ def show_question(request, question, paper, error_message=None, notification=Non reason='Your time is up!' return complete(request, reason, paper.attempt_number, paper.question_paper.id) if question in paper.questions_answered.all(): - notification = 'You have already attempted this question' + notification = 'You have already attempted this question successfully' \ + if question.type == "code" else \ + 'You have already attempted this question' test_cases = question.get_test_cases() files = FileUpload.objects.filter(question_id=question.id, hide=False) context = {'question': question, 'paper': paper, 'error_message': error_message, |