From 77321c3590301a8550b8b351b6e8bbb382dc8947 Mon Sep 17 00:00:00 2001 From: Hardik Ghaghada Date: Mon, 1 Jul 2013 12:48:12 +0530 Subject: made changes as per the comments on pull request --- testapp/exam/views.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'testapp/exam/views.py') 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 -- cgit