Skip to content

Commit c38819b

Browse files
committed
Improve the solution to sorting events now that a None is officially supported
1 parent 3d65f8e commit c38819b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/pytito/admin/account.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ def events(self) -> dict[str, Event]:
7272
@property
7373
def next_event(self) -> Event:
7474
"""
75-
Return the chronologically first of the upcoming events
75+
Return the chronologically first of the upcoming events, excluding events without a
76+
start_at set
7677
"""
7778

78-
# in some case draft event may not have a start date configured so must be excluded
79+
# in some case a start date configured so must be excluded
7980
def include_event(event: Event) -> bool:
80-
# pylint:disable-next=protected-access
81-
return event._json_content['start_at'] is not None
81+
return event.start_at is not None
8282

8383
upcoming_events = list(filter(include_event, self.events.values()))
8484
upcoming_events.sort(key=attrgetter('start_at'))

0 commit comments

Comments
 (0)