X-Git-Url: https://apps.delaporte.us/gitweb/matrix-shop-bot.git/blobdiff_plain/b0d59de8e794c84f2089515e3adf3a68703c96b8..050ee98fbbfea0a1cde53a5853e1da905f8cbb7b:/matrix_shop_bot/db.py?ds=sidebyside diff --git a/matrix_shop_bot/db.py b/matrix_shop_bot/db.py index 6cacc33..a225f3c 100644 --- a/matrix_shop_bot/db.py +++ b/matrix_shop_bot/db.py @@ -51,7 +51,7 @@ class PreferStore(SQLModel, table=True): store_id: int | None = Field(default=None, foreign_key="store.id", primary_key=True) def _get_item_zone(item_name, session) -> str: - zone = session.exec(select(ItemZone).where(func.lower(ItemZone.name) == func.lower(item_name))).first() + zone = session.exec(select(ItemZone).where(func.lower(item_name).contains(func.lower(ItemZone.name)))).first() if zone: return zone.zone return 'No Zone Assigned' @@ -191,6 +191,7 @@ class Data(): return ['Success'] def list_purchases(self, store_name): + '''List unique purchases at store in the past 90 days''' with Session(self.engine) as session: recent = dt.now() - timedelta(days=90) cmd = select(PurchaseRecord).where(func.lower(PurchaseRecord.store) == func.lower(store_name)).where(PurchaseRecord.purchase_date > recent)