Skip to content

Commit d462963

Browse files
committed
Include submission resources in session export
1 parent 628090d commit d462963

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/download.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
# Build resource list dynamically based on exclusions
3535
resources = [
36-
"submissions?state=confirmed&expand=answers.question,submission_type,track,slots.room",
36+
"submissions?state=confirmed&expand=answers.question,submission_type,track,slots.room,resources",
3737
"speakers?expand=answers.question",
3838
]
3939

src/models/pretalx.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,19 @@ def duration_to_string(cls, v) -> str:
9090
@field_validator("resources", mode="before")
9191
@classmethod
9292
def handle_resources(cls, v) -> list[dict[str, str]] | None:
93-
if v and all(isinstance(res, int) for res in v):
94-
# currently, ?expand=resources is broken in Pretalx
95-
# https://github.com/pretalx/pretalx/issues/2040
96-
return None
9793
return v or None
9894

9995
@model_validator(mode="before")
10096
@classmethod
10197
def process_values(cls, values) -> dict:
98+
# Transform resource information
99+
if raw_resources := values.get("resources"):
100+
resources = [
101+
{"description": res["description"], "resource": res["resource"]}
102+
for res in raw_resources
103+
]
104+
values["resources"] = resources
105+
102106
# Set slot information
103107
if values.get("slots"):
104108
slot = PretalxSlot.model_validate(values["slots"][0])
@@ -169,6 +173,9 @@ def process_values(cls, values) -> dict:
169173
# merge submission fields into slot
170174
slot_dict.update(slot_dict.get("submission", {}))
171175

176+
# remove resource IDs (not expandable with API, not required for schedule)
177+
slot_dict.pop("resources", None)
178+
172179
submission_slots.append(slot_dict)
173180

174181
values["slots"] = submission_slots

0 commit comments

Comments
 (0)