diff options
author | maheshgudi | 2017-10-05 20:39:22 +0530 |
---|---|---|
committer | maheshgudi | 2017-10-05 20:41:34 +0530 |
commit | f5701e1c6ba3700b834257a4b84388485cb8818d (patch) | |
tree | 31364c34ce9b9165541e8e1b8e1c722f36399967 /yaksh/models.py | |
parent | 72c9a0f2a84925b9f8096702aa702e1deb49e2ce (diff) | |
download | online_test-f5701e1c6ba3700b834257a4b84388485cb8818d.tar.gz online_test-f5701e1c6ba3700b834257a4b84388485cb8818d.tar.bz2 online_test-f5701e1c6ba3700b834257a4b84388485cb8818d.zip |
Use MCQ/MCC testcases id instead of options to validate answer
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 6 |
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'] |