diff options
author | ankitjavalkar | 2016-11-04 19:20:20 +0530 |
---|---|---|
committer | ankitjavalkar | 2016-11-10 12:43:14 +0530 |
commit | 4904a8305e7e83a00cef718a42bbbf8e7d5f8740 (patch) | |
tree | 43d9ffee43fcc0621633d7eb6406f03808ea8689 /yaksh/models.py | |
parent | 576c92b3b7d8989bf6bb99316d096f48f5b4cc24 (diff) | |
download | online_test-4904a8305e7e83a00cef718a42bbbf8e7d5f8740.tar.gz online_test-4904a8305e7e83a00cef718a42bbbf8e7d5f8740.tar.bz2 online_test-4904a8305e7e83a00cef718a42bbbf8e7d5f8740.zip |
Add partial grade mark for stdio test case and fix model test cases
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index e7a96c9..33c3b42 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -941,14 +941,10 @@ class AnswerPaper(models.Model): def _update_marks_obtained(self): """Updates the total marks earned by student for this paper.""" - # marks = sum([x.marks for x in self.answers.filter(marks__gt=0.0)]) - # if not marks: - # self.marks_obtained = 0 - # else: - # self.marks_obtained = marks marks = 0 for question in self.questions.all(): - max_marks = max([a.marks for a in self.answers.filter(question=question)]) + marks_list = [a.marks for a in self.answers.filter(question=question)] + max_marks = max(marks_list) if marks_list else 0.0 marks += max_marks self.marks_obtained = marks @@ -1128,10 +1124,12 @@ class StandardTestCase(TestCase): class StdioBasedTestCase(TestCase): expected_input = models.TextField(blank=True) expected_output = models.TextField() + marks = models.FloatField(default=0.0) def get_field_value(self): return {"expected_output": self.expected_output, - "expected_input": self.expected_input} + "expected_input": self.expected_input, + "marks": self.marks} def __str__(self): return u'Question: {0} | Exp. Output: {1} | Exp. Input: {2}'.format(self.question, |