diff options
-rw-r--r-- | yaksh/templates/yaksh/view_answerpaper.html | 5 | ||||
-rw-r--r-- | yaksh/templatetags/custom_filters.py | 5 | ||||
-rw-r--r-- | yaksh/views.py | 5 |
3 files changed, 12 insertions, 3 deletions
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 }} <br/> End time : {{ paper.end_time }} <br/> Percentage obtained: {{ paper.percent }}% <br/> - {% if paper.passed == 0 %} + {% if paper.passed %} Status : <b style="color: red;"> Failed </b><br/> {% else %} Status : <b style="color: green;"> Passed </b><br/> @@ -55,7 +55,8 @@ <h5><u>Question:</u></h5> <strong>{{ question.description|safe }}</strong> {% if question.type == "mcq" or question.type == "mcc" %} <h5> <u>Choices:</u></h5> - {% for testcase in question.get_test_cases %} + {% get_ordered_testcases question paper as testcases %} + {% for testcase in testcases %} {% if testcase.correct %} <br/> <strong>{{ forloop.counter }}. {{ testcase.options|safe }}</strong> 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) |