From 054cb7a7d898cab8902dd6c97db4072b01bd2af9 Mon Sep 17 00:00:00 2001 From: prathamesh Date: Fri, 23 Oct 2020 03:55:43 +0530 Subject: Update marks using CSV file upload --- yaksh/models.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'yaksh/models.py') 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 -- cgit