summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authorankitjavalkar2016-12-22 15:55:54 +0530
committerankitjavalkar2016-12-22 16:51:26 +0530
commit42ed7c142e2c4ff4dccdaec2365e22d30bc276dd (patch)
treed1eb3c0039478294f4169d6e761ed42dd78a6327 /yaksh/models.py
parenta88197040b69a556f9c7b0432350b9d1d4aad06f (diff)
downloadonline_test-42ed7c142e2c4ff4dccdaec2365e22d30bc276dd.tar.gz
online_test-42ed7c142e2c4ff4dccdaec2365e22d30bc276dd.tar.bz2
online_test-42ed7c142e2c4ff4dccdaec2365e22d30bc276dd.zip
Refactor check method for cleaner code and fixing multiple issues
- Question should skip to new question with new error rendering - Fix test cases Fix change_dir context manager in grader
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 378d7a1..08feab6 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1064,20 +1064,20 @@ class AnswerPaper(models.Model):
For code questions success is True only if the answer is correct.
"""
- result = {'success': True, 'error': 'Incorrect answer', 'weight': 0.0}
+ result = {'success': True, 'error': ['Incorrect answer'], 'weight': 0.0}
correct = False
if user_answer is not None:
if question.type == 'mcq':
expected_answer = question.get_test_case(correct=True).options
if user_answer.strip() == expected_answer.strip():
correct = True
- result['error'] = 'Correct answer'
+ result['error'] = ['Correct answer']
elif question.type == 'mcc':
expected_answers = []
for opt in question.get_test_cases(correct=True):
expected_answers.append(opt.options)
if set(user_answer) == set(expected_answers):
- result['error'] = 'Correct answer'
+ result['error'] = ['Correct answer']
correct = True
elif question.type == 'code':
user_dir = self.user.profile.get_user_dir()