From e402a8667069e66d526c9e14bbd0cdbc24a50ba4 Mon Sep 17 00:00:00 2001 From: Liam Steckler Date: Tue, 30 Jan 2024 07:19:13 -0800 Subject: [PATCH] Log map_media and initial post IDs --- scl.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scl.py b/scl.py index 58b8fd5..e7e8eb8 100644 --- a/scl.py +++ b/scl.py @@ -83,6 +83,8 @@ class SclOutage(Base): scl_outage_id: Mapped[int] = mapped_column(primary_key=True, unique=True) outage_user_id: Mapped[str] = mapped_column() most_recent_post_id: Mapped[Optional[str]] = mapped_column() + initial_post_id: Mapped[Optional[str]] = mapped_column() + map_media_post_id: Mapped[Optional[str]] = mapped_column() last_updated_time: Mapped[datetime] = mapped_column() estimated_restoration_time: Mapped[datetime] = mapped_column() cause: Mapped[str] = mapped_column() @@ -93,7 +95,7 @@ class SclOutage(Base): num_people: Mapped[int] = mapped_column() def __repr__(self) -> str: - return f"SclOutage(scl_outage_id={self.scl_outage_id!r}, most_recent_post_id={self.most_recent_post_id!r}, last_updated_time={self.last_updated_time!r}, no_longer_in_response_time={self.no_longer_in_response_time!r}), start_time={self.start_time!r}), num_people={self.num_people!r})" + return f"SclOutage(scl_outage_id={self.scl_outage_id!r}, most_recent_post_id={self.most_recent_post_id!r}, initial_post_id={self.initial_post_id!r}, map_media_post_id={self.map_media_post_id!r}, last_updated_time={self.last_updated_time!r}, no_longer_in_response_time={self.no_longer_in_response_time!r}), start_time={self.start_time!r}), num_people={self.num_people!r})" engine = create_engine("sqlite:///scl.db") @@ -363,13 +365,15 @@ with Session(engine) as session: scl_outage_id=event["id"], outage_user_id=event["identifier"], most_recent_post_id=mastodon_post_result["id"], + initial_post_id=mastodon_post_result["id"], last_updated_time=last_updated_time, estimated_restoration_time=estimated_restoration_time, cause=event["cause"], status=status, outage_size=outage_size, start_time=start_time, - num_people=event["numPeople"] + num_people=event["numPeople"], + map_media_post_id=map_media_post["id"], ) session.add(new_outage_record) session.commit()