Determine if the event has ever hit the class to post
This commit is contained in:
parent
53155f02a8
commit
2f90d1b236
1 changed files with 14 additions and 8 deletions
6
scl.py
6
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,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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue