Determine if the event has ever hit the class to post

This commit is contained in:
Liam Steckler 2024-01-30 17:57:25 -08:00
parent 53155f02a8
commit 2f90d1b236

6
scl.py
View file

@ -175,6 +175,7 @@ with Session(engine) as session:
if existing_record.max_num_people < event["numPeople"]:
# Used to determine the maximum number of people affected by this outage, to determine if it's worth posting about
existing_record.max_num_people = event["numPeople"]
max_event_class = classify_event_size(existing_record.max_num_people)
if updated_properties:
updated_properties.sort()
@ -196,6 +197,7 @@ with Session(engine) as session:
)
updated_entries.append("")
updated_entries.append(hashtag_string)
if max_event_class["is_postable"] and existing_record.initial_post_id:
post_result = mastodon.status_post(
status="\n".join(updated_entries),
in_reply_to_id=existing_record.most_recent_post_id,
@ -203,6 +205,10 @@ with Session(engine) as session:
language="en",
)
existing_record.most_recent_post_id = post_result["id"]
elif max_event_class["is_postable"]:
print(
"This event would have been able to be posted, but someone didn't write the logic to do that for events that scaled up."
)
session.commit()