From afe07ad0bafbff14f77fe835003ccb7f2d637686 Mon Sep 17 00:00:00 2001 From: Gene Takavic Date: Tue, 13 Dec 2022 15:27:28 +0100 Subject: [PATCH] fix get_hits, get_refunds --- lnbits/extensions/boltcards/crud.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lnbits/extensions/boltcards/crud.py b/lnbits/extensions/boltcards/crud.py index 0724ea04..346b5522 100644 --- a/lnbits/extensions/boltcards/crud.py +++ b/lnbits/extensions/boltcards/crud.py @@ -179,6 +179,9 @@ async def get_hit(hit_id: str) -> Optional[Hit]: async def get_hits(cards_ids: Union[str, List[str]]) -> List[Hit]: + if len(cards_ids) == 0: + return [] + q = ",".join(["?"] * len(cards_ids)) rows = await db.fetchall( f"SELECT * FROM boltcards.hits WHERE card_id IN ({q})", (*cards_ids,) @@ -273,6 +276,9 @@ async def get_refund(refund_id: str) -> Optional[Refund]: async def get_refunds(hits_ids: Union[str, List[str]]) -> List[Refund]: + if len(hits_ids) == 0: + return [] + q = ",".join(["?"] * len(hits_ids)) rows = await db.fetchall( f"SELECT * FROM boltcards.refunds WHERE hit_id IN ({q})", (*hits_ids,)