diff options
author | Hardik Ghaghada | 2013-07-01 12:48:12 +0530 |
---|---|---|
committer | Hardik Ghaghada | 2013-07-01 12:48:12 +0530 |
commit | 77321c3590301a8550b8b351b6e8bbb382dc8947 (patch) | |
tree | dc47ea1a0315467ff8ac4559ae9877f6e25f0c69 /testapp/exam | |
parent | 5ce91d1f2b2f2434bc51ddeeaf4f9f27305d1145 (diff) | |
download | online_test-77321c3590301a8550b8b351b6e8bbb382dc8947.tar.gz online_test-77321c3590301a8550b8b351b6e8bbb382dc8947.tar.bz2 online_test-77321c3590301a8550b8b351b6e8bbb382dc8947.zip |
made changes as per the comments on pull request
Diffstat (limited to 'testapp/exam')
-rw-r--r-- | testapp/exam/views.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/testapp/exam/views.py b/testapp/exam/views.py index 6c977ee..4956f84 100644 --- a/testapp/exam/views.py +++ b/testapp/exam/views.py @@ -695,16 +695,15 @@ def check(request, q_id, questionpaper_id=None): # Add the answer submitted, regardless of it being correct or not. new_answer = Answer(question=question, answer=user_answer, correct=False) - new_answer.save() - paper.answers.add(new_answer) + else: - """Add the answer submitted with the Snippet code, - regardless of it being correct or not.""" + # Add the answer submitted with the Snippet code (correct or incorrect) answer_check = snippet_code + "\n" + user_answer new_answer = Answer(question=question, answer=answer_check, correct=False) - new_answer.save() - paper.answers.add(new_answer) + + new_answer.save() + paper.answers.add(new_answer) # If we were not skipped, we were asked to check. For any non-mcq # questions, we obtain the results via XML-RPC with the code executed |