8000 Fix schedule · EuroPython/programapi@f173309 · GitHub
[go: up one dir, main page]

Skip to content

Commit f173309

Browse files
committed
Fix schedule
1 parent 8d85510 commit f173309

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
@@ -24,7 +24,11 @@
2424
}
2525

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

2933
# Build resource list dynamically based on exclusions
3034
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)
0