X-Git-Url: https://apps.delaporte.us/gitweb/matrix-shop-bot.git/blobdiff_plain/a64200d96f4add62e58f2d845eca5fe301b58b26..b87cc9cac0fee1d8d1c281a3f445097cb8af2691:/matrix_shop_bot/db.py diff --git a/matrix_shop_bot/db.py b/matrix_shop_bot/db.py index 05ca9eb..bab1837 100644 --- a/matrix_shop_bot/db.py +++ b/matrix_shop_bot/db.py @@ -80,7 +80,7 @@ class Data(): def add_item(self, name): item_id = self._add_with_name(Item, name) - if self.last_store_id: + if isinstance(self.last_store_id, int): with Session(self.engine) as session: store_id = self.last_store_id store = session.exec(_get_with_id(Store, store_id)).first() @@ -132,7 +132,9 @@ class Data(): return items def get_shopping_list(self, store_id=None) -> List[str]: - if not store_id: + if isinstance(store_id, int): + self.last_store_id = store_id + else: store_id = self.last_store_id results = []