ignore invalid opening hours entries (#48702)
This commit is contained in:
parent
1e300df3d8
commit
274e139cbe
|
@ -209,8 +209,11 @@ def get_slots_from_mairie_format(data, base_datetime):
|
|||
if specification.get('opens') and specification.get('closes'):
|
||||
# case when opening periods are defined
|
||||
if base_datetime >= valid_from and base_datetime < valid_through:
|
||||
(opening_time, closing_time, day_number) = get_open_close_from_specification(
|
||||
specification, valid_from, base_datetime)
|
||||
try:
|
||||
(opening_time, closing_time, day_number) = get_open_close_from_specification(
|
||||
specification, valid_from, base_datetime)
|
||||
except ValueError:
|
||||
continue
|
||||
slots.append(TimeSlot(opening_time, closing_time))
|
||||
else:
|
||||
# case when exclusions are defined
|
||||
|
@ -291,8 +294,11 @@ def get_mairie_opening_hours(mairie_data):
|
|||
if 'opens' in specification and 'closes' in specification:
|
||||
# parse specification only for the current period relative to utcnow()
|
||||
if base_datetime >= valid_from and base_datetime < valid_through:
|
||||
(opening_time, closing_time, day_number) = get_open_close_from_specification(
|
||||
specification, valid_from, base_datetime)
|
||||
try:
|
||||
(opening_time, closing_time, day_number) = get_open_close_from_specification(
|
||||
specification, valid_from, base_datetime)
|
||||
except ValueError:
|
||||
continue
|
||||
abbr_day_of_week = EN_ABBREV_WEEKDAYS_LIST[day_number]
|
||||
(period, all_day_hours) = get_period_from_data(abbr_day_of_week,
|
||||
opening_time=opening_time, closing_time=closing_time)
|
||||
|
|
Loading…
Reference in New Issue