a77d48fb4f63

Add a set of shows to check.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 03 Oct 2011 20:47:22 -0400
parents 77f9ac55543d
children 89f24149ecd7
branches/tags (none)
files resources/public/css/style.less src/newseasons/models/shows.clj src/newseasons/views/main.clj

Changes

--- a/resources/public/css/style.less	Mon Oct 03 20:30:15 2011 -0400
+++ b/resources/public/css/style.less	Mon Oct 03 20:47:22 2011 -0400
@@ -54,6 +54,9 @@
 }
 
 // Layout
+html {
+    overflow-y: scroll;
+}
 header {
     text-align: center;
     margin-top: 24px;
--- a/src/newseasons/models/shows.clj	Mon Oct 03 20:30:15 2011 -0400
+++ b/src/newseasons/models/shows.clj	Mon Oct 03 20:47:22 2011 -0400
@@ -16,6 +16,13 @@
 ;     image: url to show's image
 ;     url: url to view the show on iTunes
 ; }
+;
+; The shows we need to check are stored in two places for durability and ease of
+; use:
+;
+; shows:to-check = z#{<iTunes artist ID>, ...}
+; shows:to-check:queue = [<iTunes artist ID, ...]
+;              push to --^                      ^-- pop from
 
 ; Code ------------------------------------------------------------------------
 
@@ -43,3 +50,6 @@
 (defn show-set-url! [id new-url]
   @(r [:hset (key-show id) "url" new-url]))
 
+(defn show-add-to-checked! [id]
+  @(r [:sadd "shows:to-check" id]))
+
--- a/src/newseasons/views/main.clj	Mon Oct 03 20:30:15 2011 -0400
+++ b/src/newseasons/views/main.clj	Mon Oct 03 20:47:22 2011 -0400
@@ -55,6 +55,13 @@
      (force-login)
      (do ~@body)))
 
+
+(defn create-user [email password]
+  (users/user-set-email! email email)
+  (users/user-set-pass! email password)
+  (sess/put! :email email)
+  (users/user-get email))
+
 (defn check-login [{:keys [email password]}]
   (if (some empty? [email password])
     (flash! "Both fields are required.  This really shouldn't be difficult.")
@@ -66,11 +73,7 @@
             (sess/put! :email email)
             user)
           (flash! "Invalid login!"))
-        (do
-          (users/user-set-email! email email)
-          (users/user-set-pass! email password)
-          (sess/put! :email email)
-          (users/user-get email))))))
+        (create-user email password)))))
 
 
 ; Home ------------------------------------------------------------------------
@@ -118,6 +121,7 @@
 (defpage [:post "/add"] {:keys [artist-id]}
          (login-required
            (users/user-add-show! (sess/get :email) artist-id)
+           (shows/show-add-to-checked! artist-id)
            (flash! "Added a show to your list.")
            (resp/redirect "/")))