X-Git-Url: https://apps.delaporte.us/gitweb/matrix-shop-bot.git/blobdiff_plain/f636eed1859db9f987dd7a0badaee48bb051237f..895434f80adf39e2122f592c09a8ade36209a8a7:/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 = []