summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authorankitjavalkar2020-11-04 18:01:19 +0530
committerGitHub2020-11-04 18:01:19 +0530
commit46da73d199e227c3f7abfa8d720d073496211b5e (patch)
tree08b4c380986270c06e8ce8c1a14bf91c5239b536 /yaksh/models.py
parent2371058b9cf8fd953e8e089ac51702475a102ff7 (diff)
parent054cb7a7d898cab8902dd6c97db4072b01bd2af9 (diff)
downloadonline_test-46da73d199e227c3f7abfa8d720d073496211b5e.tar.gz
online_test-46da73d199e227c3f7abfa8d720d073496211b5e.tar.bz2
online_test-46da73d199e227c3f7abfa8d720d073496211b5e.zip
Merge pull request #783 from prathamesh920/upload-marks-csv
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 2a06cc8..e2b9952 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1711,12 +1711,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)
@@ -2360,6 +2365,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