summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authormahesh2018-02-07 15:58:54 +0530
committermaheshgudi2018-03-16 15:15:50 +0530
commit3fb6c4219c7c288fdf47ca300a1d859653c358b3 (patch)
treebaf860a4d47d7f53c2feec9d1a0a794bf2cd6185 /yaksh/models.py
parent537d0fc5c5884ab620e587ff977ed61a2a50504d (diff)
downloadonline_test-3fb6c4219c7c288fdf47ca300a1d859653c358b3.tar.gz
online_test-3fb6c4219c7c288fdf47ca300a1d859653c358b3.tar.bz2
online_test-3fb6c4219c7c288fdf47ca300a1d859653c358b3.zip
Add test cases for Arrange question type
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 7c5bb85..a79f2f6 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1822,13 +1822,21 @@ class AnswerPaper(models.Model):
user_answer = self.answers.filter(question=question).last()
if not user_answer:
return False, msg + 'Did not answer.'
- if question.type == 'mcc':
+ if question.type in ['mcc', 'arrange']:
try:
- answer = eval(user_answer.answer)
+ answer = literal_eval(user_answer.answer)
if type(answer) is not list:
- return False, msg + 'MCC answer not a list.'
+ return (False,
+ msg + '{0} answer not a list.'.format(
+ question.type
+ )
+ )
except Exception:
- return False, msg + 'MCC answer submission error'
+ return (False,
+ msg + '{0} answer submission error'.format(
+ question.type
+ )
+ )
else:
answer = user_answer.answer
json_data = question.consolidate_answer_data(answer) \
@@ -2048,4 +2056,4 @@ class TestCaseOrder(models.Model):
#Order of the test case for a question.
order = models.TextField()
-
+##############################################################################