summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authormahesh2018-02-07 16:28:06 +0530
committermaheshgudi2018-03-16 15:15:50 +0530
commitb3bb71b80bd10eb49c7930d9cf6be109673cbe53 (patch)
tree317e593370e4f85412cee647db7af5beb56903b4 /yaksh
parent3fb6c4219c7c288fdf47ca300a1d859653c358b3 (diff)
downloadonline_test-b3bb71b80bd10eb49c7930d9cf6be109673cbe53.tar.gz
online_test-b3bb71b80bd10eb49c7930d9cf6be109673cbe53.tar.bz2
online_test-b3bb71b80bd10eb49c7930d9cf6be109673cbe53.zip
Arrange options according to last submitted answer if any
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/templates/yaksh/question.html3
-rw-r--r--yaksh/templatetags/custom_filters.py5
2 files changed, 7 insertions, 1 deletions
diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html
index e67a260..3bdabd1 100644
--- a/yaksh/templates/yaksh/question.html
+++ b/yaksh/templates/yaksh/question.html
@@ -256,6 +256,9 @@ question_type = "{{ question.type }}"
{% endif %}
{% if question.type == "arrange" %}
+ {% if last_attempt %}
+ {% get_arrange_user_answer last_attempt question as test_cases %}
+ {% endif %}
<input name="answer" type="hidden" id='arrange_order'/>
<div class="list-group">
<ol class="arrange">
diff --git a/yaksh/templatetags/custom_filters.py b/yaksh/templatetags/custom_filters.py
index 05c363c..e24a792 100644
--- a/yaksh/templatetags/custom_filters.py
+++ b/yaksh/templatetags/custom_filters.py
@@ -71,7 +71,10 @@ def get_ordered_testcases(question, answerpaper):
@register.simple_tag
def get_arrange_user_answer(ans, question):
- ans = str(ans)
+ if type(ans) == bytes:
+ ans = ans.decode("utf-8")
+ else:
+ ans = str(ans)
ans_list = literal_eval(ans)
testcase_list = []
for answer_id in ans_list: