Skip to content

Commit

Permalink
correct the incorrect type references and adjust variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
chen-tf committed Jul 23, 2023
1 parent e84b1fd commit bbf26b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions pt_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,12 @@ def _price_sync_handler(good_info: GoodInfo) -> None:
new_good_info.stock_state == GoodInfoStockState.IN_STOCK
and good_info.stock_state == GoodInfoStockState.OUT_OF_STOCK
):
logger.info("%s is in stock!", new_good_info.name)
follow_good_chat_ids = user_repository.find_all_user_by_good_id(good_id)
msg = "%s\n目前已經可購買!!!\n\n%s"
for follow_good_chat_id in follow_good_chat_ids:
logger.info(f"{new_good_info.name} is in stock!")
follow_good_users = user_repository.find_all_user_by_good_id(good_id)
for user in follow_good_users:
pt_bot.send(
msg % (new_good_info.name, good_page_url),
str(follow_good_chat_id),
f"{new_good_info.name}\n目前已經可購買!!!\n\n{good_page_url}",
str(user.chat_id),
)
except pt_error.GoodNotException:
if new_good_info is not None:
Expand Down
2 changes: 1 addition & 1 deletion repository/user_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def find_all_by_state(state: UserState, session: Session) -> List[User]:


@with_session
def find_all_user_by_good_id(good_id: str, session: Session):
def find_all_user_by_good_id(good_id: str, session: Session) -> List[User]:
return (
session.query(User)
.join(UserSubGood)
Expand Down

0 comments on commit bbf26b3

Please sign in to comment.