[WIP] refactoring/location-club-statistics #71

Draft
Fred wants to merge 19 commits from refactoring/location-club-statistics into master
2 changed files with 23 additions and 0 deletions
Showing only changes of commit fa6c6d531a - Show all commits

View File

@ -330,6 +330,12 @@ class Course(Markdownizable, Temporizable):
"""
return time_diff(self.hour_begin, self.hour_end)
@property
def total_number_of_hours(self) -> timedelta:
"""Retourne le temps total a été consacré à ce cours
"""
return self.get_number_of_real_occurrences * self.number_of_hours
@property
def get_number_of_planned_occurrences(self):
return self.get_total_occurence()

View File

@ -73,6 +73,23 @@ class TestCourse(TestCase):
self.assertEqual(course.get_number_of_real_occurrences, 0)
def test_total_number_of_hours_should_be_39_times_3(self):
"""Vérifie que le nombre total d'heures consacrées est bien égal à 39 séances * 3h
Remarks:
39 séances * 3h = 117h = 4 jours + 21h = timedelta(days=3, seconds=75600) :-)
"""
course = Course.objects.create(
iso_day_number=2,
datebegin=datetime(2021, 1, 1),
dateend=datetime(2021, 9, 30),
hour_begin=time(hour=19, minute=0),
hour_end=time(hour=22, minute=0),
club=self.club
)
self.assertEqual(course.total_number_of_hours, timedelta(days=4, seconds=75600))
def test_number_of_real_occurrences_should_be_21(self):
course = Course.objects.create(
iso_day_number=2,