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()
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 = []