Fix price ordering

NULL price values were being sorted before cards with prices available.
This commit is contained in:
Correl Roush 2022-07-28 19:30:50 -04:00
parent 736a1a07e7
commit 5b6344a695

View file

@ -183,7 +183,7 @@ async def advanced_search(
]
if sort_by == "price":
orderings = [
"CAST(COALESCE(card_prices.usd, card_prices.usd_foil) as decimal) DESC",
"CAST(COALESCE(card_prices.usd, card_prices.usd_foil, 0) as decimal) DESC",
*orderings,
]
params["last_update_key"] = "last_update"
@ -198,7 +198,7 @@ async def advanced_search(
f"LIMIT {limit} OFFSET {offset}",
]
)
logger.critical("Query: %s", (query, params))
logger.debug("Query: %s", (query, params))
await db.execute(query, params)
rows = await db.fetchall()