diff options
Diffstat (limited to 'testapp')
-rw-r--r-- | testapp/exam/models.py | 14 | ||||
-rw-r--r-- | testapp/exam/tests.py | 8 |
2 files changed, 11 insertions, 11 deletions
diff --git a/testapp/exam/models.py b/testapp/exam/models.py index 0d31b16..4d82783 100644 --- a/testapp/exam/models.py +++ b/testapp/exam/models.py @@ -249,8 +249,8 @@ class AnswerPaper(models.Model): # Marks percent scored by the user percent = models.FloatField(null=True, default=None) - # Result of the quiz, pass if True. - result = models.NullBooleanField() + # Result of the quiz, True if student passes the exam. + passed = models.NullBooleanField() def current_question(self): """Returns the current active question to display.""" @@ -332,16 +332,16 @@ class AnswerPaper(models.Model): percent = self.marks_obtained/self.question_paper.total_marks*100 self.percent = round(percent, 2) - def update_result(self): + def update_passed(self): """ - Updates the result. - It is either passed or failed, as per the quiz passing criteria + Checks whether student passed or failed, as per the quiz + passing criteria. """ if self.percent is not None: if self.percent >= self.question_paper.quiz.pass_criteria: - self.result = True + self.passed = True else: - self.result = False + self.passed = False def get_question_answers(self): """ diff --git a/testapp/exam/tests.py b/testapp/exam/tests.py index eb63ba4..d76e4f8 100644 --- a/testapp/exam/tests.py +++ b/testapp/exam/tests.py @@ -273,10 +273,10 @@ class AnswerPaperTestCases(unittest.TestCase): self.answerpaper.update_percent() self.assertEqual(self.answerpaper.percent, 33.33) - def test_update_result(self): - """ Test update_result() method of AnswerPaper""" - self.answerpaper.update_result() - self.assertFalse(self.answerpaper.result) + def test_update_passed(self): + """ Test update_passed method of AnswerPaper""" + self.answerpaper.update_passed() + self.assertFalse(self.answerpaper.passed) def test_get_question_answer(self): """ Test get_question_answer() method of Answer Paper""" |