Fix collection stats query

Only include latest prices so the card count and value totals are
reported correctly.
This commit is contained in:
Correl Roush 2022-12-08 15:37:40 -05:00
parent 6fefc74506
commit 6ef889fc06

View file

@ -373,6 +373,8 @@ async def collection_stats(db: psycopg.Cursor) -> dict:
FROM "copies" FROM "copies"
JOIN "cards" USING ("scryfall_id") JOIN "cards" USING ("scryfall_id")
LEFT JOIN "card_prices" USING ("scryfall_id") LEFT JOIN "card_prices" USING ("scryfall_id")
WHERE "card_prices"."date" =
(SELECT "value" FROM "vars" where "key" = 'last_update')
""" """
) )
return await db.fetchone() return await db.fetchone()