                 :status 201
                 :body (page "Voted" [:p "Thank you for voting for team " teamid "!"])})))
      (GET "/await-vote" [:as req]
-          (if (= :voting state)
-            (redirect "/vote")
+          (if (= :voting @state)
+            (redirect "/")
             (page-await-vote (get-in req [:headers "referer"]))))
      (GET "/vote" [] "Sorry, you can only POST to this page")
      (GET "/vote-results" [] (page-vote-results @teams @votes))


(defn page-await-vote [referer]
  (page "Awaiting voting..."
        [:p "Do "
         [:a {:href "/"} "vote for the best idea"]
         " once voting is opened"]

;; TIME USED: (time-in-hrs + 3.5 1.5 1 + 1) + (5h lørdag, 1t søndag)
;; incl.: learning and setting up heroku (1h), learning/troubleshooting (2+h)

(defonce ^{:static true} server-stop-fn (atom nil))

(defn -main [port] ;; entry point
  (let [port (Integer/parseInt port)
