From 3e28ae1843032cb8e228ea7532af74d010e0c032 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 18 Sep 2023 13:25:49 +0100 Subject: [PATCH] List of lists --- happening.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/happening.py b/happening.py index f2cbe76cd..5b2a5bcce 100644 --- a/happening.py +++ b/happening.py @@ -232,20 +232,21 @@ def _event_text_match(content: str, text_match: str) -> bool: return False -def _sort_todays_events(events: []) -> []: +def _sort_todays_events(post_events_list: []) -> []: """Returns a list of events sorted in chronological order """ events_dict = {} # convert the list to a dict indexed on time - for tag in events: - # only check events (not places) - if tag['type'] != 'Event': - continue - event_time = \ - datetime.strptime(tag['startTime'], - "%Y-%m-%dT%H:%M:%S%z") - events_dict[event_time] = tag + for post_event in post_events_list: + for tag in post_event: + # only check events (not places) + if tag['type'] != 'Event': + continue + event_time = \ + datetime.strptime(tag['startTime'], + "%Y-%m-%dT%H:%M:%S%z") + events_dict[event_time] = tag # sort the dict new_events = []