templatetags: remove redondant code (#50404)

This commit is contained in:
Nicolas Roche 2021-01-21 15:34:17 +01:00
parent ce7092ff68
commit 045a98a06c
1 changed files with 1 additions and 7 deletions

View File

@ -292,14 +292,8 @@ def get_slots_from_mairie_format(data, base_datetime):
slots.append(timeslot)
# order slots and cycle the list beginning with 'base_datetime'
slots = sorted(slots, key=operator.attrgetter('start'))
if len(slots):
slots.sort(key=operator.attrgetter('start'))
def timedelta_key_func(slot):
return slot.start - base_datetime
nearest_slot_index = slots.index(min(slots, key=timedelta_key_func))
slots = slots[nearest_slot_index:] + slots[:nearest_slot_index]
return (slots, exclusion_slots, known_format)