summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authorprathamesh2020-10-23 03:55:43 +0530
committerprathamesh2020-10-23 03:55:43 +0530
commit054cb7a7d898cab8902dd6c97db4072b01bd2af9 (patch)
tree90e253235fe8a9b551f54553a74b689c2ca0ee38 /yaksh/models.py
parent430c8d1480d897e9fc0dc328bad173642d0a2946 (diff)
downloadonline_test-054cb7a7d898cab8902dd6c97db4072b01bd2af9.tar.gz
online_test-054cb7a7d898cab8902dd6c97db4072b01bd2af9.tar.bz2
online_test-054cb7a7d898cab8902dd6c97db4072b01bd2af9.zip
Update marks using CSV file upload
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index da2327c..6f7af53 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1710,12 +1710,17 @@ class Answer(models.Model):
# Whether skipped or not.
skipped = models.BooleanField(default=False)
+ comment = models.TextField(null=True, blank=True)
+
def set_marks(self, marks):
if marks > self.question.points:
self.marks = self.question.points
else:
self.marks = marks
+ def set_comment(self, comments):
+ self.comment = comments
+
def __str__(self):
return "Answer for question {0}".format(self.question.summary)
@@ -2359,6 +2364,11 @@ class AnswerPaper(models.Model):
self.end_time = datetime
self.save()
+ def get_answer_comment(self, question_id):
+ answer = self.answers.filter(question_id=question_id).last()
+ if answer:
+ return answer.comment
+
def get_question_answers(self):
"""
Return a dictionary with keys as questions and a list of the