From 2007380ea15212887e00a0ec3854da68c46b47bb Mon Sep 17 00:00:00 2001 From: gered Date: Sat, 16 Jun 2018 11:12:01 -0400 Subject: [PATCH] fix set views "owned (unique)" card statistic --- src/mtgcoll/views/functions/sets.clj | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mtgcoll/views/functions/sets.clj b/src/mtgcoll/views/functions/sets.clj index fff210f..2051edf 100644 --- a/src/mtgcoll/views/functions/sets.clj +++ b/src/mtgcoll/views/functions/sets.clj @@ -15,10 +15,11 @@ where c.set_code = s.code ) as card_count, ( - select count(*) + select count(distinct c.id) from collection cl join cards c on cl.card_id = c.id - where c.set_code = s.code and cl.quantity > 0 and cl.list_id = 0 + where c.set_code = s.code + and cl.quantity > 0 and cl.list_id = 0 ) as owned_count from sets s where s.code = ?" code]) @@ -44,9 +45,10 @@ where c.set_code = s.code ) as card_count, ( - select count(*) + select count(distinct c.id) from collection cl join cards c on cl.card_id = c.id - where c.set_code = s.code and cl.quantity > 0 and cl.list_id = 0 + where c.set_code = s.code + and cl.quantity > 0 and cl.list_id = 0 ) as owned_count from sets s"])