From 421fee8933745adf3e03f21704fc326495368f6a Mon Sep 17 00:00:00 2001 From: Liam Steckler Date: Wed, 31 Jan 2024 21:26:41 -0800 Subject: [PATCH] Correct expression --- scl.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scl.py b/scl.py index 6fefe4f..867994f 100644 --- a/scl.py +++ b/scl.py @@ -409,14 +409,16 @@ with Session(engine) as session: session.add(new_outage_record) session.commit() - lookup_active_outages_statement = select(SclOutage).where( - SclOutage.no_longer_in_response_time == None - - ).where( - SclOutage.most_recent_post_id + lookup_active_outages_statement = ( + select(SclOutage) + .where(SclOutage.no_longer_in_response_time == None) + .where(SclOutage.most_recent_post_id != None) ) for active_outage in session.scalars(lookup_active_outages_statement): - if not any(event["id"] == active_outage.scl_outage_id for event in scl_events) and event: + if ( + not any(event["id"] == active_outage.scl_outage_id for event in scl_events) + and event + ): # Event ID no longer exists in response post_result = mastodon.status_post( status="This outage is reported to be resolved.\n\n#SeattleCityLightOutage #SCLOutage #SCLOutage{}".format(