summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprathamesh2014-06-22 09:42:38 +0530
committerprathamesh2014-06-22 09:42:38 +0530
commitc525c8f26b8e926733d5e4e3d415e19250e54e72 (patch)
tree7e29521a61b1717bb011275c8e38a9ab5d23ac22
parenta31b44d170a26a51587d3c1c1080d5d90f1db356 (diff)
downloadonline_test-c525c8f26b8e926733d5e4e3d415e19250e54e72.tar.gz
online_test-c525c8f26b8e926733d5e4e3d415e19250e54e72.tar.bz2
online_test-c525c8f26b8e926733d5e4e3d415e19250e54e72.zip
Made changes to update_total_marks method
-rw-r--r--testapp/exam/models.py3
-rw-r--r--testapp/exam/tests.py4
2 files changed, 5 insertions, 2 deletions
diff --git a/testapp/exam/models.py b/testapp/exam/models.py
index 22c7913..42c5d5a 100644
--- a/testapp/exam/models.py
+++ b/testapp/exam/models.py
@@ -148,7 +148,8 @@ class QuestionPaper(models.Model):
marks += question.points
for question_set in self.random_questions.all():
marks += question_set.marks * question_set.num_questions
- return marks
+ self.total_marks = marks
+ return None
def _get_questions_for_answerpaper(self):
""" Returns fixed and random questions for the answer paper"""
diff --git a/testapp/exam/tests.py b/testapp/exam/tests.py
index 2a5f1e7..b2ba36f 100644
--- a/testapp/exam/tests.py
+++ b/testapp/exam/tests.py
@@ -138,7 +138,9 @@ class QuestionPaperTestCases(unittest.TestCase):
def test_update_total_marks(self):
""" Test update_total_marks() method of Question Paper"""
- self.assertEqual(self.question_paper.update_total_marks(), 15)
+ self.assertEqual(self.question_paper.total_marks, 0)
+ self.question_paper.update_total_marks()
+ self.assertEqual(self.question_paper.total_marks, 15)
def test_get_random_questions(self):
""" Test get_random_questions() method of Question Paper"""