fix: get speaker biography directly from speaker code
This commit is contained in:
parent
3ba116c7fa
commit
bda40b1935
@ -59,13 +59,11 @@ def get_slots():
|
||||
return backend.get(endpoint=f"events/{app.local_config['pretalx']['event']}/schedules/{app.local_config['pretalx']['schedule']}/").json()
|
||||
|
||||
|
||||
def get_speaker_biography(name):
|
||||
def get_speaker_biography(code):
|
||||
try:
|
||||
speaker_info = backend.get(endpoint=f"events/{app.local_config['pretalx']['event']}/speakers/", params={"q": name}).json()
|
||||
logger.debug(speaker_info)
|
||||
return speaker_info["results"][0]["biography"].strip()
|
||||
speaker_info = backend.get(endpoint=f"events/{app.local_config['pretalx']['event']}/speakers/{code}/").json()
|
||||
return speaker_info.get("biography").strip()
|
||||
except Exception as err:
|
||||
logger.warning(f"UnknownSpeakerError: {name} from {str(err)}")
|
||||
return None
|
||||
|
||||
|
||||
@ -126,7 +124,7 @@ def planning():
|
||||
slots = get_slots()
|
||||
for slot in slots.get("slots"):
|
||||
for speaker in slot.get("speakers"):
|
||||
speaker["biography"] = get_speaker_biography(speaker.get("name"))
|
||||
speaker["biography"] = get_speaker_biography(speaker.get("code"))
|
||||
return render_template("planning.html",
|
||||
slots=sorted(slots.get("slots"),
|
||||
key=lambda slot: slot.get("slot").get("start")),
|
||||
|
Loading…
Reference in New Issue
Block a user