fix for trying to retrieve ascii art under a name which returns none
This commit is contained in:
parent
df0f6d7429
commit
01eb85c7dc
|
@ -56,10 +56,12 @@
|
||||||
(throw (new IndexOutOfBoundsException)))))
|
(throw (new IndexOutOfBoundsException)))))
|
||||||
|
|
||||||
(defn get-random-ascii-art [name]
|
(defn get-random-ascii-art [name]
|
||||||
(->> (couch/get-view-with-db (db-library) "list" "ids" {:key name})
|
(let [results (couch/get-view-with-db (db-library) "list" "ids" {:key name})]
|
||||||
(rand-nth)
|
(if (seq results)
|
||||||
:value
|
(->> results
|
||||||
(get-ascii-art)))
|
(rand-nth)
|
||||||
|
:value
|
||||||
|
(get-ascii-art)))))
|
||||||
|
|
||||||
(defn get-art-count []
|
(defn get-art-count []
|
||||||
(->> (couch/get-view-with-db (db-library) "list" "count")
|
(->> (couch/get-view-with-db (db-library) "list" "count")
|
||||||
|
|
Reference in a new issue