diff options
author | maheshgudi | 2017-10-04 21:26:12 +0530 |
---|---|---|
committer | maheshgudi | 2017-10-04 21:27:24 +0530 |
commit | 88a37e73cabe8f396631132b2cffdddd5bcae17f (patch) | |
tree | 4069c6a7f48293f1beea81101622e145b441da91 | |
parent | ba817cda209787e4bc959aac8d16726a8aea1ed9 (diff) | |
download | online_test-88a37e73cabe8f396631132b2cffdddd5bcae17f.tar.gz online_test-88a37e73cabe8f396631132b2cffdddd5bcae17f.tar.bz2 online_test-88a37e73cabe8f396631132b2cffdddd5bcae17f.zip |
User can see previously submitted answers for non code questions
-rw-r--r-- | yaksh/models.py | 3 | ||||
-rw-r--r-- | yaksh/templates/yaksh/grade_user.html | 2 | ||||
-rw-r--r-- | yaksh/templates/yaksh/question.html | 32 |
3 files changed, 21 insertions, 16 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 0d67397..49e028b 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -1308,8 +1308,7 @@ class AnswerPaper(models.Model): return self.time_left() > 0 def get_previous_answers(self, question): - if question.type == 'code': - return self.answers.filter(question=question).order_by('-id') + return self.answers.filter(question=question).order_by('-id') def validate_answer(self, user_answer, question, json_data=None, uid=None): """ diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html index 9cdfb1a..52f319c 100644 --- a/yaksh/templates/yaksh/grade_user.html +++ b/yaksh/templates/yaksh/grade_user.html @@ -114,7 +114,7 @@ Status : <b style="color: green;"> Passed </b><br/> {% for question, answers in paper.get_question_answers.items %} {% with answers|last as answer %} <tr> - <td>{{ question.id }}</td> + <td>{{ question.summary }}</td> <td>{{ answer.answer.marks }}</td> </tr> {% endwith %} diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index 3a3066c..eb6eb3d 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -53,7 +53,7 @@ function updateClock(){ var ss = ('0' + t.seconds).slice(-2); if(t.total<0){ - + document.forms["code"].submit(); clearInterval(timeinterval); return null; @@ -77,10 +77,7 @@ function validate(){ $("#upload_alert").modal("show"); return false; } - else - { - send_request(); - } + return true; } function call_skip(url) @@ -155,32 +152,44 @@ lang = "{{ question.language }}" <div class="panel-body"> {% if question.type == "mcq" %} {% for test_case in test_cases %} - <input name="answer" type="radio" value="{{ test_case.options }}" />{{ test_case.options|safe }} <br/> + {% if last_attempt and last_attempt|safe == test_case.options|safe %} + <input name="answer" type="radio" value="{{ test_case.options }}" checked /> + {{ test_case.options|safe }} <br/> + {% else %} + <input name="answer" type="radio" value="{{ test_case.options }}" /> + {{ test_case.options|safe }} <br/> + {% endif %} {% endfor %} {% endif %} {% if question.type == "integer" %} Enter Integer:<br/> - <input name="answer" type="number" id="integer" /> + <input name="answer" type="number" id="integer" value={{ last_attempt|safe }} /> <br/><br/> {% endif %} {% if question.type == "string" %} Enter Text:<br/> - <textarea name="answer" id="string"></textarea> + <textarea name="answer" id="string">{{ last_attempt|safe }}</textarea> <br/><br/> {% endif %} {% if question.type == "float" %} Enter Decimal Value :<br/> - <input name="answer" type="number" step="any" id="float" /> + <input name="answer" type="number" step="any" id="float" value={{ last_attempt|safe }} /> <br/><br/> {% endif %} {% if question.type == "mcc" %} {% for test_case in test_cases %} - <input name="answer" type="checkbox" value="{{ test_case.options }}"> {{ test_case.options|safe }} + {% if last_attempt and test_case.options|safe in last_attempt|safe %} + <input name="answer" type="checkbox" value="{{ test_case.options }}" checked/> {{ test_case.options }} <br> + {% else %} + <input name="answer" type="checkbox" value="{{ test_case.options }}"> + {{ test_case.options}} + <br/> + {% endif %} {% endfor %} {% endif %} {% if question.type == "upload" %} @@ -241,6 +250,3 @@ lang = "{{ question.language }}" </div> </div> {% endblock main %} - - - |