summaryrefslogtreecommitdiff
path: root/yaksh/templates
diff options
context:
space:
mode:
authorprathamesh2020-11-27 04:18:27 +0530
committerprathamesh2020-11-27 04:18:27 +0530
commit60503c9bd1ea49177f0adfc39ff129bfba86c9de (patch)
tree4a28541ee208317e27801bd3f07fa0ea0e78bacf /yaksh/templates
parent3a442d0142aac2bb6f1d5379e1d533b9b8fc6da6 (diff)
downloadonline_test-60503c9bd1ea49177f0adfc39ff129bfba86c9de.tar.gz
online_test-60503c9bd1ea49177f0adfc39ff129bfba86c9de.tar.bz2
online_test-60503c9bd1ea49177f0adfc39ff129bfba86c9de.zip
Fix answer paper view.
- Slight optimisation in retrieving and rendering the data - avoids the arrange type question's custom filter error - Marks obtained appears properly on all the interface(user view answerpaper, monitor and grade user) - if not attempted then shows the question and says "Did not attempt"
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/>