From b3bb71b80bd10eb49c7930d9cf6be109673cbe53 Mon Sep 17 00:00:00 2001 From: mahesh Date: Wed, 7 Feb 2018 16:28:06 +0530 Subject: Arrange options according to last submitted answer if any --- yaksh/templates/yaksh/question.html | 3 +++ yaksh/templatetags/custom_filters.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'yaksh') 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 %}
    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: -- cgit