From f5701e1c6ba3700b834257a4b84388485cb8818d Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Thu, 5 Oct 2017 20:39:22 +0530 Subject: Use MCQ/MCC testcases id instead of options to validate answer --- yaksh/templates/yaksh/grade_user.html | 26 +++++++++++++++++++++----- yaksh/templates/yaksh/question.html | 12 ++++++------ yaksh/templates/yaksh/user_data.html | 18 ++++++++++++++++++ yaksh/templates/yaksh/view_answerpaper.html | 29 ++++++++++++++++++++++++----- 4 files changed, 69 insertions(+), 16 deletions(-) (limited to 'yaksh/templates') diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html index 2038210..37bc788 100644 --- a/yaksh/templates/yaksh/grade_user.html +++ b/yaksh/templates/yaksh/grade_user.html @@ -236,7 +236,7 @@ Status : Passed
- +
Line No.
Expected Output
User output
@@ -256,7 +256,7 @@ Status : Passed
- + @@ -268,12 +268,28 @@ Status : Passed
- {% if question.type != "code" %} + {% if question.type == "code" %} +
{{ ans.answer.answer.strip|safe }}
+ {% elif question.type == "mcc"%}
- {{ ans.answer.answer.strip|safe }} + {% for testcases in question.get_test_cases %} + {%if testcases.id|stringformat:"i" in ans.answer.answer.strip|safe %} +
  • {{ testcases.options.strip|safe }}
  • + {% endif %} + {% endfor %} +
    + {% elif question.type == "mcq"%} +
    + {% for testcases in question.get_test_cases %} + {%if testcases.id|stringformat:"i" == ans.answer.answer.strip|safe %} +
  • {{ testcases.options.strip|safe }}
  • + {% endif %} + {% endfor %}
    {% else %} -
    {{ ans.answer.answer.strip|safe }}
    +
    + {{ ans.answer.answer.strip|safe }} +
    {% endif %}
    diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index bc7acf1..1e1f38f 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -153,11 +153,11 @@ lang = "{{ question.language }}"
    {% if question.type == "mcq" %} {% for test_case in test_cases %} - {% if last_attempt and last_attempt|safe == test_case.options|safe %} - + {% if last_attempt and last_attempt|safe == test_case.id|safe %} + {{ test_case.options|safe }}
    {% else %} - + {{ test_case.options|safe }}
    {% endif %} {% endfor %} @@ -183,11 +183,11 @@ lang = "{{ question.language }}" {% if question.type == "mcc" %} {% for test_case in test_cases %} - {% if last_attempt and test_case.options|safe in last_attempt|safe %} - {{ test_case.options }} + {% if last_attempt and test_case.id|safe in last_attempt|safe %} + {{ test_case.options }}
    {% else %} - + {{ test_case.options}}
    {% endif %} diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html index a8adc22..31a023d 100644 --- a/yaksh/templates/yaksh/user_data.html +++ b/yaksh/templates/yaksh/user_data.html @@ -104,11 +104,29 @@ User IP address: {{ paper.user_ip }}
    Student answer:
    + {% if question.type == "mcc"%} +
    + {% for testcases in question.get_test_cases %} + {%if testcases.id|stringformat:"i" in answers.0.answer|safe %} +
  • {{ testcases.options.strip|safe }}
  • + {% endif %} + {% endfor %} +
    + {% elif question.type == "mcq"%} +
    + {% for testcases in question.get_test_cases %} + {%if testcases.id|stringformat:"i" == answers.0.answer|safe %} +
  • {{ testcases.options.strip|safe }}
  • + {% endif %} + {% endfor %} +
    + {%else%}
    {{ answers.0.answer|safe }}
    + {% endif %} {% else %}
    Student answer:
    {% for answer in answers %} diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html index 9edff5a..850d789 100644 --- a/yaksh/templates/yaksh/view_answerpaper.html +++ b/yaksh/templates/yaksh/view_answerpaper.html @@ -82,16 +82,35 @@ Autocheck: {{ answers.0.error_list.0 }}
    -
    Student answer:
    -
    - {{ answers.0.answer|safe }} - {% if question.type == "upload" and has_user_assignment %} + {% if question.type == "mcc"%} +
    + {% for testcases in question.get_test_cases %} + {%if testcases.id|stringformat:"i" in answers.0.answer|safe %} +
  • {{ testcases.options.strip|safe }}
  • + {% endif %} + {% endfor %} +
    + {% elif question.type == "mcq"%} +
    + {% for testcases in question.get_test_cases %} + {%if testcases.id|stringformat:"i" == answers.0.answer|safe %} +
  • {{ testcases.options.strip|safe }}
  • + {% endif %} + {% endfor %} +
    + {% elif question.type == "upload" and has_user_assignment %} + + {% else %} +
    Student answer:
    +
    + {{ answers.0.answer|safe }} +
    + {% endif %}
    {% else %} -- cgit
    Error: {{error.error_msg}}