feat: handling various timeslot descriptions

This commit is contained in:
Jean-Marie Favreau 2024-10-12 19:30:20 +02:00
parent b56cbf66a0
commit 2feb6219f7

View File

@ -63,9 +63,14 @@ class CExtractor(Extractor):
if not date is None and is_open: if not date is None and is_open:
# we reach a new day # we reach a new day
result.append((date, tstart, tend)) result.append((date, tstart, tend))
date = day if isinstance(day, tuple):
tstart = None date = day[0]
tend = None tstart = day[1]
tend = day[2]
else:
date = day
tstart = None
tend = None
is_open = False is_open = False
continue continue
elif not is_open: elif not is_open:
@ -79,8 +84,14 @@ class CExtractor(Extractor):
hours = CExtractor.find_hours(e) hours = CExtractor.find_hours(e)
if not hours is None: if not hours is None:
# we found hours # we found hours
tstart = hours[0] if tstart is None:
tend = hours[1] tstart = hours[0]
else:
tstart = min(tstart, hours[0])
if tend is None:
tend = hours[1]
else:
tend = max(tend, hours[1])
continue continue
if CExtractor.is_canceled(e): if CExtractor.is_canceled(e):