mirror of
https://github.com/stijndcl/didier.git
synced 2026-05-17 03:05:47 +02:00
Put slots in set at the end
This commit is contained in:
parent
3a44a1b679
commit
ce7ba4285a
1 changed files with 4 additions and 3 deletions
|
|
@ -222,7 +222,7 @@ async def parse_schedule_from_content(content: str, *, database_session: AsyncSe
|
||||||
calendar = Calendar(content)
|
calendar = Calendar(content)
|
||||||
events = list(calendar.events)
|
events = list(calendar.events)
|
||||||
course_codes: dict[str, UforaCourse] = {}
|
course_codes: dict[str, UforaCourse] = {}
|
||||||
slots: set[ScheduleSlot] = set()
|
slots: list[ScheduleSlot] = []
|
||||||
|
|
||||||
for event in events:
|
for event in events:
|
||||||
code = parse_course_code(event.name)
|
code = parse_course_code(event.name)
|
||||||
|
|
@ -248,9 +248,10 @@ async def parse_schedule_from_content(content: str, *, database_session: AsyncSe
|
||||||
if any(s.could_merge_with(slot) for s in slots):
|
if any(s.could_merge_with(slot) for s in slots):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
slots.add(slot)
|
slots.append(slot)
|
||||||
|
|
||||||
return Schedule(slots=slots)
|
# Cast to set at the END because the __hash__ can change while merging with others
|
||||||
|
return Schedule(slots=set(slots))
|
||||||
|
|
||||||
|
|
||||||
async def parse_schedule(name: ScheduleType, *, database_session: AsyncSession) -> Optional[Schedule]:
|
async def parse_schedule(name: ScheduleType, *, database_session: AsyncSession) -> Optional[Schedule]:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue