summaryrefslogtreecommitdiff
path: root/yaksh/templates
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2020-12-10 17:47:24 +0530
committerGitHub2020-12-10 17:47:24 +0530
commit6b7feb2f3f1a090e76087c8ba7ac2b600fecacd0 (patch)
tree5df0961b50b76af69cce423e7ea5fcf872676e07 /yaksh/templates
parent56883784cdcd2a4f1a60cdaa7ba28525cfd21132 (diff)
parent60503c9bd1ea49177f0adfc39ff129bfba86c9de (diff)
downloadonline_test-6b7feb2f3f1a090e76087c8ba7ac2b600fecacd0.tar.gz
online_test-6b7feb2f3f1a090e76087c8ba7ac2b600fecacd0.tar.bz2
online_test-6b7feb2f3f1a090e76087c8ba7ac2b600fecacd0.zip
Merge pull request #803 from prathamesh920/fix-answerpaper-view
Fix answer paper view.
Diffstat (limited to 'yaksh/templates')
-rw-r--r--yaksh/templates/yaksh/grade_user.html14
-rw-r--r--yaksh/templates/yaksh/user_data.html17
-rw-r--r--yaksh/templates/yaksh/view_answerpaper.html14
3 files changed, 22 insertions, 23 deletions
diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html
index 341fd7c..64b9cb5 100644
--- a/yaksh/templates/yaksh/grade_user.html
+++ b/yaksh/templates/yaksh/grade_user.html
@@ -319,7 +319,6 @@ function searchNames() {
</thead>
<tbody>
{% for question, answers in paper.get_question_answers.items %}
- {% with answers|last as answer %}
<tr>
<td>
<a href="#question_{{question.id}}">
@@ -327,14 +326,13 @@ function searchNames() {
</a>
</td>
<td>{{ question.type }}</td>
- <td>{{ answer.marks }}</td>
+ <td>{{ answers|last }}</td>
<td>
<a href="{% url 'yaksh:regrade_by_question' course_id quiz.questionpaper_set.get.id paper.id question.id %}" class="btn btn-outline-success">
<i class="fa fa-repeat"></i>&nbsp;Regrade
</a>
</td>
</tr>
- {% endwith %}
{% endfor %}
</tbody>
</table>
@@ -437,7 +435,10 @@ function searchNames() {
</center>
{% endif %} <!-- End has_user_assignments -->
{% else %}
- {% for ans in answers %}
+ {% if answers|first is None %}
+ <p> Did not attempt </p>
+ {% else %}
+ {% for ans in answers|slice:":-1" %}
<strong>
Attempt Number: {{forloop.counter}}
</strong>
@@ -559,6 +560,7 @@ function searchNames() {
</div>
<br>
{% endfor %} <!-- End for ans in answers -->
+ {% endif %}<!-- check if attempted -->
</div>
</div>
{% endif %}
@@ -566,9 +568,7 @@ function searchNames() {
<div class="form-group">
<div class="col-md-2">
<label class="col-form-label" for="q{{ question.id }}">Marks:</label>
- {% with answers|last as answer %}
- <input id="q{{ question.id }}" type="text" name="q{{ question.id }}_marks" size="4" class="form-control" value="{{ answer.marks }}"><br><br>
- {% endwith %}
+ <input id="q{{ question.id }}" type="text" name="q{{ question.id }}_marks" size="4" class="form-control" value="{{ answers|last }}"><br><br>
</div>
</div>
<hr/>
diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html
index a79071d..0506df0 100644
--- a/yaksh/templates/yaksh/user_data.html
+++ b/yaksh/templates/yaksh/user_data.html
@@ -78,11 +78,7 @@
<tr>
<td>{{question.summary}}</td>
<td>{{question.type}}</td>
- <td>
- {% for answer in answers %}
- {{answer.marks}}
- {% endfor %}
- </td>
+ <td>{{ answers|last }}</td>
</tr>
{% endfor %}
</tbody>
@@ -181,7 +177,11 @@
</center>
{% endif %} <!-- End has_user_assignments -->
{% else %}
- {% for ans in answers %}
+
+ {% if answers|first is None %}
+ <p> Did not attempt </p>
+ {% else %}
+ {% for ans in answers|slice:":-1" %}
<strong>
Attempt Number: {{forloop.counter}}
</strong>
@@ -303,6 +303,7 @@
</div>
<br>
{% endfor %} <!-- End for ans in answers -->
+ {% endif %}<!-- check if attempted -->
</div>
</div>
{% endif %}
@@ -310,9 +311,7 @@
<div class="form-group">
<div class="col-md-2">
<label class="col-form-label" for="q{{ question.id }}">Marks:</label>
- {% with answers|last as answer %}
- <input id="q{{ question.id }}" type="text" name="q{{ question.id }}_marks" size="4" class="form-control" value="{{ answer.marks }}" readonly=""><br><br>
- {% endwith %}
+ <input id="q{{ question.id }}" type="text" name="q{{ question.id }}_marks" size="4" class="form-control" value="{{ answers|last }}" readonly=""><br><br>
</div>
</div>
<hr/>
diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html
index 905a111..775525e 100644
--- a/yaksh/templates/yaksh/view_answerpaper.html
+++ b/yaksh/templates/yaksh/view_answerpaper.html
@@ -80,7 +80,6 @@
</thead>
<tbody>
{% for question, answers in paper.get_question_answers.items %}
- {% with answers|last as answer %}
<tr>
<td>
<a href="#question_{{question.id}}">
@@ -88,9 +87,8 @@
</a>
</td>
<td>{{ question.type }}</td>
- <td>{{ answer.answer.marks }}</td>
+ <td>{{ answers|last }}{{ answer.answer.marks }}</td>
</tr>
- {% endwith %}
{% endfor %}
</tbody>
</table>
@@ -200,7 +198,10 @@
</center>
{% endif %} <!-- End has_user_assignments -->
{% else %}
- {% for ans in answers %}
+ {% if answers|first is None %}
+ <p> Did not attempt </p>
+ {% else %}
+ {% for ans in answers|slice:":-1" %}
<strong>
Attempt Number: {{forloop.counter}}
</strong>
@@ -324,6 +325,7 @@
</div>
<br>
{% endfor %} <!-- End for ans in answers -->
+ {% endif %}<!-- check if attempted -->
</div>
</div>
{% endif %}
@@ -331,9 +333,7 @@
<div class="form-group">
<div class="col-md-2">
<label class="col-form-label" for="q{{ question.id }}">Marks:</label>
- {% with answers|last as answer %}
- <input id="q{{ question.id }}" type="text" name="q{{ question.id }}_marks" size="4" class="form-control" value="{{ answer.answer.marks }}" readonly=""><br><br>
- {% endwith %}
+ <input id="q{{ question.id }}" type="text" name="q{{ question.id }}_marks" size="4" class="form-control" value="{{ answers|last }}" readonly=""><br><br>
</div>
</div>
<hr/>