Fix bug creating limerick with new database

main
Eric Ihli 3 years ago
parent 3b2e79f0aa
commit 71253e7a1c

@ -5,3 +5,11 @@
Requires [[https://github.com/tachyons-css/tachyons/][Tachyons CSS]]. There is a symlink in ~web/resources/public~ to the pre-built ~tachyons.css~ and ~tachyons.min.css~ found in the repo.
Build ~.jar~ with ~clojure -X:depstart uberjar :jar prhyme.jar~.
* TODO
** Use tightly packed trie for limerick generation
** Move limerick-specific code into this repo from Prhyme.
Or maybe into its own repo.

@ -64,15 +64,13 @@
albums (albums/artist-albums db (:artist/id artist))
limericks (db.limericks/album-limericks db (:album/id (first albums)))]
(cond
(< (count limericks) 10)
(do
(when (or (nil? artist)
(nil? (first albums)))
(throw (ex-info "Nil artist or album" {:artist artist
:album (first albums)})))
[(:artist/id artist) (:album/id (first albums))])
(and artist
albums
(< (count limericks) 10))
[(:artist/id artist) (:album/id (first albums))]
(< (count albums) 5)
(and artist
(< (count albums) 5))
(let [album-name (linguistics/gen-album)
{album-id :album/id} (albums/insert-album db album-name (:artist/id artist))]
(when (or (nil? (:artist/id artist))

Loading…
Cancel
Save