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
22
scl.py
22
scl.py
|
@ -175,6 +175,7 @@ with Session(engine) as session:
|
||||||
if existing_record.max_num_people < event["numPeople"]:
|
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
|
# 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"]
|
existing_record.max_num_people = event["numPeople"]
|
||||||
|
max_event_class = classify_event_size(existing_record.max_num_people)
|
||||||
|
|
||||||
if updated_properties:
|
if updated_properties:
|
||||||
updated_properties.sort()
|
updated_properties.sort()
|
||||||
|
@ -196,15 +197,20 @@ with Session(engine) as session:
|
||||||
)
|
)
|
||||||
updated_entries.append("")
|
updated_entries.append("")
|
||||||
updated_entries.append(hashtag_string)
|
updated_entries.append(hashtag_string)
|
||||||
post_result = mastodon.status_post(
|
if max_event_class["is_postable"] and existing_record.initial_post_id:
|
||||||
status="\n".join(updated_entries),
|
post_result = mastodon.status_post(
|
||||||
in_reply_to_id=existing_record.most_recent_post_id,
|
status="\n".join(updated_entries),
|
||||||
visibility="public",
|
in_reply_to_id=existing_record.most_recent_post_id,
|
||||||
language="en",
|
visibility="public",
|
||||||
)
|
language="en",
|
||||||
existing_record.most_recent_post_id = post_result["id"]
|
)
|
||||||
|
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:
|
except NoResultFound:
|
||||||
print("Existing record not found")
|
print("Existing record not found")
|
||||||
|
|
Loading…
Reference in a new issue