From b7d655a21ecbbf46d9e02f7f80dd465b2119dc13 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Mon, 22 Jan 2024 13:04:08 +0000 Subject: [PATCH] Conference CFP end dates as events Closes: #122 --- agenda/conference.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/agenda/conference.py b/agenda/conference.py index 50b0b35..24ed552 100644 --- a/agenda/conference.py +++ b/agenda/conference.py @@ -48,8 +48,9 @@ class Conference: def get_list(filepath: str) -> list[Event]: """Read conferences from a YAML file and return a list of Event objects.""" - return [ - Event( + events: list[Event] = [] + for conf in (Conference(**conf) for conf in yaml.safe_load(open(filepath, "r"))): + event = Event( name="conference", date=conf.start, end_date=conf.end, @@ -57,5 +58,15 @@ def get_list(filepath: str) -> list[Event]: url=conf.url, going=conf.going, ) - for conf in (Conference(**conf) for conf in yaml.safe_load(open(filepath, "r"))) - ] + events.append(event) + if not conf.cfp_end: + continue + cfp_end_event = Event( + name="cfp_end", + date=conf.cfp_end, + title="CFP end: " + conf.display_name, + url=conf.cfp_url or conf.url, + ) + events.append(cfp_end_event) + + return events