Skip to content

Commit 9440cf2

Browse files
committed
Fix schedule
1 parent 646d238 commit 9440cf2

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/download.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525
}
2626

2727
base_url = f"https://pretalx.com/api/events/{Config.event}/"
28-
schedule_url = base_url + "schedules/latest/"
28+
schedule_url = (
29+
base_url
30+
+ "schedules/latest?expand="
31+
+ "slots,slots.submission,slots.submission.submission_type,slots.submission.track,slots.room"
32+
)
2933

3034
# Build resource list dynamically based on exclusions
3135
resources = [

src/models/pretalx.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,28 @@ class PretalxSchedule(BaseModel):
149149

150150
slots: list[PretalxSubmission]
151151
breaks: list[PretalxScheduleBreak]
152+
153+
@model_validator(mode="before")
154+
@classmethod
155+
def process_values(cls, values) -> dict:
156+
submission_slots = []
157+
break_slots = []
158+
for slot_dict in values["slots"]:
159+
# extract nested slot fields into slot
160+
slot_object = PretalxSlot.model_validate(slot_dict)
161+
slot_dict["slot"] = slot_object
162+
slot_dict["room"] = slot_object.room
163+
slot_dict["start"] = slot_object.start
164+
slot_dict["end"] = slot_object.end
165+
166+
if slot_dict.get("submission") is None:
167+
break_slots.append(slot_dict)
168+
else:
169+
# merge submission fields into slot
170+
slot_dict.update(slot_dict.get("submission", {}))
171+
172+
submission_slots.append(slot_dict)
173+
174+
values["slots"] = submission_slots
175+
values["breaks"] = break_slots
176+
return values

0 commit comments

Comments
 (0)