Correct expression

This commit is contained in:
Liam Steckler 2024-01-31 21:26:41 -08:00
parent 08d896fb61
commit 421fee8933

14
scl.py
View file

@ -409,14 +409,16 @@ with Session(engine) as session:
session.add(new_outage_record) session.add(new_outage_record)
session.commit() session.commit()
lookup_active_outages_statement = select(SclOutage).where( lookup_active_outages_statement = (
SclOutage.no_longer_in_response_time == None select(SclOutage)
.where(SclOutage.no_longer_in_response_time == None)
).where( .where(SclOutage.most_recent_post_id != None)
SclOutage.most_recent_post_id
) )
for active_outage in session.scalars(lookup_active_outages_statement): 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 # Event ID no longer exists in response
post_result = mastodon.status_post( post_result = mastodon.status_post(
status="This outage is reported to be resolved.\n\n#SeattleCityLightOutage #SCLOutage #SCLOutage{}".format( status="This outage is reported to be resolved.\n\n#SeattleCityLightOutage #SCLOutage #SCLOutage{}".format(