This commit is contained in:
Tiago vasconcelos 2022-09-15 15:52:08 +01:00
parent ad98cb0d45
commit ee47575431
3 changed files with 15 additions and 10 deletions

View file

@ -201,7 +201,10 @@ async def get_diagonalley_stalls(wallet_ids: Union[str, List[str]]) -> List[Stal
) )
return [Stalls(**row) for row in rows] return [Stalls(**row) for row in rows]
async def get_diagonalley_stalls_by_ids(stall_ids: Union[str, List[str]]) -> List[Stalls]:
async def get_diagonalley_stalls_by_ids(
stall_ids: Union[str, List[str]]
) -> List[Stalls]:
q = ",".join(["?"] * len(stall_ids)) q = ",".join(["?"] * len(stall_ids))
rows = await db.fetchall( rows = await db.fetchall(
f"SELECT * FROM diagonalley.stalls WHERE id IN ({q})", (*stall_ids,) f"SELECT * FROM diagonalley.stalls WHERE id IN ({q})", (*stall_ids,)

View file

@ -72,7 +72,9 @@ async def display(request: Request, market_id):
stalls = await get_diagonalley_market_stalls(market_id) stalls = await get_diagonalley_market_stalls(market_id)
stalls_ids = [stall.id for stall in stalls] stalls_ids = [stall.id for stall in stalls]
products = [product.dict() for product in await get_diagonalley_products(stalls_ids)] products = [
product.dict() for product in await get_diagonalley_products(stalls_ids)
]
return diagonalley_renderer().TemplateResponse( return diagonalley_renderer().TemplateResponse(
"diagonalley/market.html", "diagonalley/market.html",
@ -80,6 +82,6 @@ async def display(request: Request, market_id):
"request": request, "request": request,
"market": market, "market": market,
"stalls": [stall.dict() for stall in stalls], "stalls": [stall.dict() for stall in stalls],
"products": products "products": products,
}, },
) )