show list card total in lists table and whether qualities are tracked
This commit is contained in:
parent
2cc0c65f0e
commit
e4c2a03b72
|
@ -98,18 +98,20 @@
|
||||||
{:bordered true :striped true :condensed true :hover true}
|
{:bordered true :striped true :condensed true :hover true}
|
||||||
[:thead
|
[:thead
|
||||||
[:tr
|
[:tr
|
||||||
[:th "Name"]
|
[:th.col-sm-7 "Name"]
|
||||||
[:th "Cards"]]]
|
[:th.col-sm-3 "Card Qualities?"]
|
||||||
|
[:th.col-sm-2 "Cards"]]]
|
||||||
[:tbody
|
[:tbody
|
||||||
(doall
|
(doall
|
||||||
(map
|
(map
|
||||||
(fn [{:keys [id name is_public]}]
|
(fn [{:keys [id name is_public require_qualities num_cards]}]
|
||||||
^{:key id}
|
^{:key id}
|
||||||
[:tr
|
[:tr
|
||||||
(if (and (auth/authenticated?) (not is_public))
|
(if (and (auth/authenticated?) (not is_public))
|
||||||
{:class "warning"})
|
{:class "warning"})
|
||||||
[:td [:a {:href (->url "#/list/" id)} [:div name]]]
|
[:td [:a {:href (->url "#/list/" id)} [:div name]]]
|
||||||
[:td "--"]])
|
[:td (if require_qualities "Yes" "")]
|
||||||
|
[:td num_cards]])
|
||||||
@lists))]]))]))))
|
@lists))]]))]))))
|
||||||
|
|
||||||
(defn on-update-list-notes!
|
(defn on-update-list-notes!
|
||||||
|
|
|
@ -23,11 +23,19 @@
|
||||||
(defn lists-list
|
(defn lists-list
|
||||||
[user-id]
|
[user-id]
|
||||||
(let [public-only? (nil? user-id)]
|
(let [public-only? (nil? user-id)]
|
||||||
["select id, name, is_public, require_qualities
|
["select l.id,
|
||||||
from lists
|
l.name,
|
||||||
where id != 0
|
l.is_public,
|
||||||
and is_public in (true, ?)
|
l.require_qualities,
|
||||||
order by name"
|
(
|
||||||
|
select coalesce(sum(lc.quantity), 0)
|
||||||
|
from lists_card_quantities lc
|
||||||
|
where lc.list_id = l.id
|
||||||
|
) as num_cards
|
||||||
|
from lists l
|
||||||
|
where l.id != 0
|
||||||
|
and l.is_public in (true, ?)
|
||||||
|
order by l.name"
|
||||||
public-only?]))
|
public-only?]))
|
||||||
|
|
||||||
(defn lists-basic-list
|
(defn lists-basic-list
|
||||||
|
|
Loading…
Reference in a new issue