summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2017-10-05 10:38:12 +0530
committerGitHub2017-10-05 10:38:12 +0530
commite79193180be5508c191a3401b018ff93c77791e5 (patch)
tree7497dc974dfc38a8ecc64671d68bd73a4e122f8e /yaksh/models.py
parent347cfa08bf8c0200fb088ac374bc9c58a66d9673 (diff)
parent9f4cf9a4e3f51855f31028fbe68bcb992ce29791 (diff)
downloadonline_test-e79193180be5508c191a3401b018ff93c77791e5.tar.gz
online_test-e79193180be5508c191a3401b018ff93c77791e5.tar.bz2
online_test-e79193180be5508c191a3401b018ff93c77791e5.zip
Merge pull request #341 from FOSSEE/hotfix7
Hotfix7
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index d9e07fd..68bde48 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1284,6 +1284,9 @@ class AnswerPaper(models.Model):
}]
return q_a
+ def get_latest_answer(self, question_id):
+ return self.answers.filter(question=question_id).order_by("id").last()
+
def get_questions(self):
return self.questions.filter(active=True)
@@ -1303,8 +1306,7 @@ class AnswerPaper(models.Model):
return self.time_left() > 0
def get_previous_answers(self, question):
- if question.type == 'code':
- return self.answers.filter(question=question).order_by('-id')
+ return self.answers.filter(question=question).order_by('-id')
def validate_answer(self, user_answer, question, json_data=None, uid=None):
"""