summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2017-10-05 21:24:56 +0530
committerGitHub2017-10-05 21:24:56 +0530
commita626f3792d03ccd96a1c49c7096076950d020c5a (patch)
tree31364c34ce9b9165541e8e1b8e1c722f36399967 /yaksh/models.py
parent72c9a0f2a84925b9f8096702aa702e1deb49e2ce (diff)
parentf5701e1c6ba3700b834257a4b84388485cb8818d (diff)
downloadonline_test-a626f3792d03ccd96a1c49c7096076950d020c5a.tar.gz
online_test-a626f3792d03ccd96a1c49c7096076950d020c5a.tar.bz2
online_test-a626f3792d03ccd96a1c49c7096076950d020c5a.zip
Merge pull request #346 from maheshgudi/hotfix7
Use MCQ/MCC testcases id instead of options to validate answer
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 b5bde04..4859d3e 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1321,15 +1321,15 @@ class AnswerPaper(models.Model):
'weight': 0.0}
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():
+ expected_answer = question.get_test_case(correct=True).id
+ if user_answer.strip() == str(expected_answer).strip():
result['success'] = True
result['error'] = ['Correct answer']
elif question.type == 'mcc':
expected_answers = []
for opt in question.get_test_cases(correct=True):
- expected_answers.append(opt.options)
+ expected_answers.append(str(opt.id))
if set(user_answer) == set(expected_answers):
result['success'] = True
result['error'] = ['Correct answer']