Par défaut, un événemnt dure 2 heures quand on calcule les intersections

This commit is contained in:
Jean-Marie Favreau 2024-11-14 23:40:52 +01:00
parent e767babd8e
commit 0ae9c399dd

View File

@ -1385,11 +1385,13 @@ class Event(models.Model):
self.current_date = date
def get_start_end_datetimes(self, day):
start_h = time().min
if self.start_day == day:
if self.start_time is None:
dtstart = datetime.combine(self.start_day, time().min)
else:
dtstart = datetime.combine(self.start_day, self.start_time)
start_h = self.start_time
else:
dtstart = datetime.combine(day, time().min)
@ -1397,7 +1399,10 @@ class Event(models.Model):
if end_day == day:
if self.end_time is None:
dtend = datetime.combine(end_day, time().max)
if end_day == self.start_day:
dtend = dtstart + timedelta(hours=2)
else:
dtend = datetime.combine(end_day, time().max)
else:
dtend = datetime.combine(end_day, self.end_time)
else: