Log map_media and initial post IDs
This commit is contained in:
parent
57ccf817e2
commit
e402a86670
1 changed files with 6 additions and 2 deletions
8
scl.py
8
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()
|
||||
|
|
Loading…
Reference in a new issue