diff options
author | ankitjavalkar | 2016-12-21 18:09:49 +0530 |
---|---|---|
committer | ankitjavalkar | 2016-12-21 18:17:48 +0530 |
commit | a88197040b69a556f9c7b0432350b9d1d4aad06f (patch) | |
tree | 9a3dd0a6a7977033d28e351c8a866c495449c530 /yaksh/templates | |
parent | fb991b4792b48c80e269236bf5aa28a70d34dbf6 (diff) | |
download | online_test-a88197040b69a556f9c7b0432350b9d1d4aad06f.tar.gz online_test-a88197040b69a556f9c7b0432350b9d1d4aad06f.tar.bz2 online_test-a88197040b69a556f9c7b0432350b9d1d4aad06f.zip |
Fix rendering and representation of errors
- Error are sent as list
- Error are None if answer is fully correct
- Error is rendered as in grade user and code questions as neat CSS divs
- Fix corresponding test cases
- Fix get_question answers in models.py
Diffstat (limited to 'yaksh/templates')
-rw-r--r-- | yaksh/templates/yaksh/grade_user.html | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html index 38f31ca..4fc5026 100644 --- a/yaksh/templates/yaksh/grade_user.html +++ b/yaksh/templates/yaksh/grade_user.html @@ -134,7 +134,7 @@ Status : <b style="color: green;"> Passed </b><br/> {% else %} <h5> <u>Test cases: </u></h5> {% for testcase in question.get_test_cases %} - <br/><strong>{{ forloop.counter }}. {{ testcase.test_case }}</strong> + <br/><strong>{{ forloop.counter }}. {{ testcase }}</strong> {% endfor %} {%endif%} </div> @@ -156,14 +156,19 @@ Status : <b style="color: green;"> Passed </b><br/> {% else %} <h5>Student answer: </h5> {% for answer in answers %} - {% if not answer.skipped %} - {% if answer.correct %} + {% if not answer.0.skipped %} + {% if answer.0.correct %} <div class="panel panel-success"> + <div class="panel-heading">Correct: {% else %} <div class="panel panel-danger"> + <div class="panel-heading">Error: {% endif %} - <div class="panel-heading">Autocheck: {{ answer.error }}</div> - <div class="panel-body"><pre><code>{{ answer.answer.strip }}</code></pre></div> + {% for err in answer.1 %} + <div><pre>{{ err }}</pre></div> + {% endfor %} + </div> + <div class="panel-body"><pre><code>{{ answer.0.answer.strip }}</code></pre></div> </div> {% endif %} {% endfor %} @@ -171,7 +176,7 @@ Status : <b style="color: green;"> Passed </b><br/> {% with answers|last as answer %} Marks: <input id="q{{ question.id }}" type="text" name="q{{ question.id }}_marks" size="4" - value="{{ answer.marks }}"><br><br> + value="{{ answer.0.marks }}"><br><br> {% endwith %} <hr/> {% endfor %} {# for question, answers ... #} |