From 98775e565c99fd6486fb5908a5ca9be491db9b1c Mon Sep 17 00:00:00 2001 From: mahesh Date: Tue, 16 Jan 2018 01:13:49 +0530 Subject: Add test case order in view_answerpaper --- yaksh/templates/yaksh/view_answerpaper.html | 5 +++-- yaksh/templatetags/custom_filters.py | 5 +++++ yaksh/views.py | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) (limited to 'yaksh') diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html index 410b578..971ef77 100644 --- a/yaksh/templates/yaksh/view_answerpaper.html +++ b/yaksh/templates/yaksh/view_answerpaper.html @@ -34,7 +34,7 @@ Start time: {{ paper.start_time }}
End time : {{ paper.end_time }}
Percentage obtained: {{ paper.percent }}%
- {% if paper.passed == 0 %} + {% if paper.passed %} Status : Failed
{% else %} Status : Passed
@@ -55,7 +55,8 @@
Question:
{{ question.description|safe }} {% if question.type == "mcq" or question.type == "mcc" %}
Choices:
- {% for testcase in question.get_test_cases %} + {% get_ordered_testcases question paper as testcases %} + {% for testcase in testcases %} {% if testcase.correct %}
{{ forloop.counter }}. {{ testcase.options|safe }} diff --git a/yaksh/templatetags/custom_filters.py b/yaksh/templatetags/custom_filters.py index 3c2c6fd..fa0802f 100644 --- a/yaksh/templatetags/custom_filters.py +++ b/yaksh/templatetags/custom_filters.py @@ -62,3 +62,8 @@ def module_completion_percent(course, module, user): @register.simple_tag def course_completion_percent(course, user): return course.percent_completed(user) + + +@register.simple_tag +def get_ordered_testcases(question, answerpaper): + return question.get_ordered_test_cases(answerpaper) \ No newline at end of file diff --git a/yaksh/views.py b/yaksh/views.py index 17cfb13..27a07d2 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -616,7 +616,10 @@ def show_question(request, question, paper, error_message=None, notification=Non if question.type == "code" else 'You have already attempted this question' ) - test_cases = question.get_ordered_test_cases(paper) + if question.type in ['mcc', 'mcq']: + test_cases = question.get_ordered_test_cases(paper) + else: + test_cases = question.get_test_cases() files = FileUpload.objects.filter(question_id=question.id, hide=False) course = Course.objects.get(id=course_id) module = course.learning_module.get(id=module_id) -- cgit