Fixed division by 0 error in calc_imputations

This commit is contained in:
Claude Paroz 2017-08-18 09:22:39 +02:00
parent 58c4aa2a97
commit 3c0e8af223
2 changed files with 13 additions and 3 deletions

View file

@ -218,6 +218,16 @@ class TeacherTests(TestCase):
result = self.teacher.calc_imputations()
self.assertEqual(result[1]['ASSC'], 9)
self.assertEqual(result[1]['EDEpe'], 5)
# Test with only EDE data
t2 = Teacher.objects.create(
first_name='Isidore', last_name='Gluck', birth_date='1986-01-01'
)
Course.objects.create(
teacher=t2, period=5, subject='Cours EDE', imputation='EDE',
)
result = t2.calc_imputations()
self.assertEqual(result[1]['EDEpe'], 2)
self.assertEqual(result[1]['EDEps'], 3)
def test_export_imputations(self):
self.client.login(username='me', password='mepassword')