fix get_hits, get_refunds

This commit is contained in:
Gene Takavic 2022-12-13 15:27:28 +01:00
parent 5abb013a43
commit afe07ad0ba

View File

@ -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,)