templatetags: remove redondant code (#50404)
This commit is contained in:
parent
ce7092ff68
commit
045a98a06c
|
@ -292,14 +292,8 @@ def get_slots_from_mairie_format(data, base_datetime):
|
||||||
slots.append(timeslot)
|
slots.append(timeslot)
|
||||||
|
|
||||||
# order slots and cycle the list beginning with 'base_datetime'
|
# order slots and cycle the list beginning with 'base_datetime'
|
||||||
slots = sorted(slots, key=operator.attrgetter('start'))
|
slots.sort(key=operator.attrgetter('start'))
|
||||||
if len(slots):
|
|
||||||
|
|
||||||
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)
|
return (slots, exclusion_slots, known_format)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue