diff options
author | mahesh | 2018-01-16 01:13:49 +0530 |
---|---|---|
committer | maheshgudi | 2018-03-16 15:15:50 +0530 |
commit | 98775e565c99fd6486fb5908a5ca9be491db9b1c (patch) | |
tree | a9ba8019171ee6b2a030c55fc82da4d7527066ac /yaksh | |
parent | 6aeda97b5f37fc7ce50b7fd1f1e0465c42ba0969 (diff) | |
download | online_test-98775e565c99fd6486fb5908a5ca9be491db9b1c.tar.gz online_test-98775e565c99fd6486fb5908a5ca9be491db9b1c.tar.bz2 online_test-98775e565c99fd6486fb5908a5ca9be491db9b1c.zip |
Add test case order in view_answerpaper
Diffstat (limited to 'yaksh')
-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) |