Format the list of updated properties into a nicer sentence
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
ci/woodpecker/push/docker-buildx Pipeline was successful

This commit is contained in:
Liam Steckler 2025-07-10 12:56:38 -07:00
parent d3feb6d03e
commit 940c626bbe
2 changed files with 13 additions and 2 deletions

4
scl.py
View file

@ -17,6 +17,7 @@ from sqlalchemy.exc import NoResultFound
from sqlalchemy.orm import DeclarativeBase, Mapped, Session, mapped_column
from geospatial import DBGeometry, convert_outage_geometry
from posttext import list_to_sentence
REQUESTS_HEADERS = {"User-Agent": "seattlecitylight-mastodon-bot"}
POST_DATETIME_FORMAT = "%b %e %l:%M %p"
@ -433,11 +434,10 @@ with Session(engine) as session:
),
)
else:
# TODO: this currently just smashes all of the properties together with commas, it'd be nice to make it actually format it like a sentence
updated_entries.insert(
0,
"The {} of this outage have been updated.\n".format(
", ".join(updated_properties)
list_to_sentence(updated_properties)
),
)
if max_event_class["is_postable"] and existing_record.initial_post_id: