From 593b4dbb66d4dc1db2cfd22200136e05b779213d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Tue, 3 Feb 2026 13:23:34 +0100 Subject: [PATCH] fix: postgres issues on `get_all_pending_games` --- crud.py | 9 +++++++-- pyproject.toml | 10 +++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/crud.py b/crud.py index fefa7ab..306643a 100644 --- a/crud.py +++ b/crud.py @@ -1,3 +1,5 @@ +from time import time + from lnbits.db import Database from lnbits.helpers import urlsafe_short_hash @@ -38,8 +40,11 @@ async def get_games_by_user(user: str) -> list[Game]: async def get_all_pending_games() -> list[Game]: return await db.fetchall( - "SELECT * FROM numberlottery.games WHERE completed = :c AND closing_date < :t", - {"c": False, "t": db.timestamp_now}, + f""" + SELECT * FROM numberlottery.games WHERE completed = :c + AND closing_date < {db.timestamp_placeholder('now')} + """, + {"c": False, "now": time()}, Game, ) diff --git a/pyproject.toml b/pyproject.toml index 0dcd313..91fb827 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,11 +7,8 @@ authors = [{ name = "Alan Bits", email = "alan@lnbits.com" }] urls = { Homepage = "https://lnbits.com", Repository = "https://github.com/lnbits/numberlottery" } dependencies = [ "lnbits>1" ] -[tool.poetry] -package-mode = false - -[tool.uv] -dev-dependencies = [ +[dependency-groups] +dev = [ "black", "pytest-asyncio", "pytest", @@ -21,6 +18,9 @@ dev-dependencies = [ "pytest-md", ] +[tool.poetry] +package-mode = false + [tool.mypy] plugins = ["pydantic.mypy"]