diff --git a/scl.py b/scl.py index 5582254..3bf8fa4 100644 --- a/scl.py +++ b/scl.py @@ -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,15 +197,20 @@ with Session(engine) as session: ) updated_entries.append("") updated_entries.append(hashtag_string) - post_result = mastodon.status_post( - status="\n".join(updated_entries), - in_reply_to_id=existing_record.most_recent_post_id, - visibility="public", - language="en", - ) - existing_record.most_recent_post_id = post_result["id"] + 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, + visibility="public", + 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() + session.commit() except NoResultFound: print("Existing record not found")