more list views. add user-id checking to recently added/changed views
This commit is contained in:
parent
90a5a26c95
commit
6265c390ae
|
@ -41,7 +41,9 @@
|
|||
(view :pricing-sources get-db #'prices/pricing-sources)
|
||||
|
||||
(view :list-info get-db #'lists/list-info {:result-set-fn first})
|
||||
(view :list-settings get-db #'lists/list-settings {:result-set-fn first})
|
||||
(view :lists-list get-db #'lists/lists-list)
|
||||
(view :lists-basic-list get-db #'lists/lists-basic-list)
|
||||
|
||||
(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})
|
||||
|
@ -76,7 +78,7 @@
|
|||
:stats/total-sets-owned-all-from :stats/most-owned-sets :stats/most-copies-of-card
|
||||
:stats/most-nonland-copies-of-card :stats/total-price :stats/agg-price-stats :stats/most-valuable-cards
|
||||
:stats/num-cards-worth-over-1-dollar :stats/card-rarity-totals :full-card-info
|
||||
:list-info :lists-list)
|
||||
:list-info :list-settings :lists-list :lists-basic-list :card-inventory :total-card-inventory)
|
||||
(= username (last parameters))
|
||||
|
||||
; views where the user-id parameter is second
|
||||
|
|
|
@ -10,6 +10,16 @@
|
|||
and is_public in (true, ?)"
|
||||
list-id public-only?]))
|
||||
|
||||
(defn list-settings
|
||||
[list-id user-id]
|
||||
(let [list-id (int list-id)
|
||||
public-only? (nil? user-id)]
|
||||
["select is_public, require_qualities
|
||||
from lists
|
||||
where id = ?
|
||||
and is_public in (true, ?)"
|
||||
list-id public-only?]))
|
||||
|
||||
(defn lists-list
|
||||
[user-id]
|
||||
(let [public-only? (nil? user-id)]
|
||||
|
@ -19,3 +29,13 @@
|
|||
and is_public in (true, ?)
|
||||
order by name"
|
||||
public-only?]))
|
||||
|
||||
(defn lists-basic-list
|
||||
[user-id]
|
||||
(let [public-only? (nil? user-id)]
|
||||
["select id, name
|
||||
from lists
|
||||
where id != 0
|
||||
and is_public in (true, ?)
|
||||
order by name"
|
||||
public-only?]))
|
||||
|
|
Loading…
Reference in a new issue