add foil card count to stats page
This commit is contained in:
parent
f2e1cacfa5
commit
23ebc7edf0
|
@ -208,6 +208,7 @@
|
|||
[online? pricing-source & [{:keys [width] :as options}]]
|
||||
(let [agg-price-stats (view-cursor :stats/agg-price-stats online? pricing-source)
|
||||
owned-total (view-cursor :stats/owned-total online?)
|
||||
owned-foil-total (view-cursor :stats/owned-foil-total online?)
|
||||
distinct-owned-total (view-cursor :stats/distinct-owned-total online?)
|
||||
total-sets-owned-from (view-cursor :stats/total-sets-owned-from online?)
|
||||
total-sets-owned-all-from (view-cursor :stats/total-sets-owned-all-from online?)
|
||||
|
@ -223,7 +224,8 @@
|
|||
[widget-row [big-currency-statistic "Median Card Value" (:median_price @agg-price-stats)]]
|
||||
[widget-row [big-number-statistic "Cards Owned Over $1 Value" @num-worth-over-1-dollar]]
|
||||
[widget-row [big-number-statistic "Partial Sets" @total-sets-owned-from]]
|
||||
[widget-row [big-number-statistic "Complete Sets" @total-sets-owned-all-from]]]))
|
||||
[widget-row [big-number-statistic "Complete Sets" @total-sets-owned-all-from]]
|
||||
[widget-row [big-number-statistic "Owned Foil Cards" @owned-foil-total]]]))
|
||||
|
||||
|
||||
(defonce settings (r/atom {:online? false
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
(view :card-pricing get-db #'prices/card-pricing)
|
||||
(view :pricing-sources get-db #'prices/pricing-sources)
|
||||
|
||||
(view :stats/owned-total get-db #'statistics/owned-total {:row-fn :sum :result-set-fn first})
|
||||
(view :stats/owned-total get-db #'statistics/owned-total {:row-fn :total :result-set-fn first})
|
||||
(view :stats/owned-foil-total get-db #'statistics/owned-foil-total {:row-fn :total :result-set-fn first})
|
||||
(view :stats/distinct-owned-total get-db #'statistics/distinct-owned-total {:row-fn :count :result-set-fn first})
|
||||
(view :stats/color-totals get-db #'statistics/color-totals {:result-set-fn first})
|
||||
(view :stats/basic-type-totals get-db #'statistics/basic-type-totals {:result-set-fn first})
|
||||
|
|
|
@ -2,19 +2,26 @@
|
|||
|
||||
(defn owned-total
|
||||
[online?]
|
||||
["select sum(quantity)
|
||||
["select coalesce(sum(quantity), 0) as total
|
||||
from collection
|
||||
where online = ?"
|
||||
(boolean online?)])
|
||||
|
||||
(defn distinct-owned-total
|
||||
[online?]
|
||||
["select count(*)
|
||||
["select count(distinct c.id)
|
||||
from cards c
|
||||
join collection cl on c.id = cl.card_id
|
||||
where cl.quantity > 0 and cl.online = ?"
|
||||
(boolean online?)])
|
||||
|
||||
(defn owned-foil-total
|
||||
[online?]
|
||||
["select coalesce(sum(quantity), 0) as total
|
||||
from collection
|
||||
where online = ? and foil = true"
|
||||
(boolean online?)])
|
||||
|
||||
(defn color-totals
|
||||
[online?]
|
||||
(let [online? (boolean online?)]
|
||||
|
|
Loading…
Reference in a new issue