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)))))
|
||||
|
||||
(defn get-random-ascii-art [name]
|
||||
(->> (couch/get-view-with-db (db-library) "list" "ids" {:key name})
|
||||
(rand-nth)
|
||||
:value
|
||||
(get-ascii-art)))
|
||||
(let [results (couch/get-view-with-db (db-library) "list" "ids" {:key name})]
|
||||
(if (seq results)
|
||||
(->> results
|
||||
(rand-nth)
|
||||
:value
|
||||
(get-ascii-art)))))
|
||||
|
||||
(defn get-art-count []
|
||||
(->> (couch/get-view-with-db (db-library) "list" "count")
|
||||
|
|
Reference in a new issue