From 574cecb8c1ebf80a0e4ef134bea7e92f913e25ce Mon Sep 17 00:00:00 2001 From: Phil Date: Thu, 20 Nov 2025 15:35:02 +0000 Subject: [PATCH] =?UTF-8?q?All=20feed=20entries=20processed=20instead=20of?= =?UTF-8?q?=20only=20the=20first.=20Sorted=20by=20published=20timestamp=20?= =?UTF-8?q?(oldest=20first)=20to=20maintain=20correct=20chronological=20or?= =?UTF-8?q?der=20in=20Discord.=20PEW=20colour=20rules=20still=20apply=20(O?= =?UTF-8?q?pen/Planned=20=E2=86=92=200x51D3D4).=20State=20saved=20per=20in?= =?UTF-8?q?cident=20so=20only=20updates/new=20incidents=20are=20posted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aastatus_to_webhook.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aastatus_to_webhook.py b/aastatus_to_webhook.py index ad33521..7af97fb 100644 --- a/aastatus_to_webhook.py +++ b/aastatus_to_webhook.py @@ -118,6 +118,14 @@ def parse_feed_entries(feed_xml): "content": html.unescape(content_text) }) + # Sort entries by published timestamp (oldest first) + def parse_date(entry): + try: + return datetime.fromisoformat(entry["published"].replace("Z", "+00:00")) + except Exception: + return datetime.min # fallback if parsing fails + + entries.sort(key=parse_date) return entries except ET.ParseError as e: