             [clj-time.format]
             [clj-time.core :only (now)]))
 
-(defrecord Show [id
+(defrecord Show [event-id
                  title
                  theatre
                  genres

      (let [new-shows (parse-shows-and-group-by-genre
                        (zip/xml-zip
                          (xml/parse
                            (str "http://finnkino.fi/xml/Schedule/?area=1002&dt="
                                 formatted-date))))]
        [formatted-date (get (swap! shows-db assoc formatted-date new-shows) formatted-date)]))))

(defn retrieve-shows-for-whole-week []
  (let [dates (take 7 (iterate #(.plusDays % 1) (now)))]
    (map retrieve-shows-by-date dates)))

(defroutes handler
  (GET "/" []

      [:th "Action"]
      [:th "Drama"]
      [:th "Others"]]
    (for [{date           :date
           shows-by-genre :shows-by-genre} shows]
      [:tr
        [:td date]
        [:td (map render-show (:comedy shows-by-genre))]
        [:td (map render-show (:action shows-by-genre))]
        [:td (map render-show (:drama shows-by-genre))]
        [:td (map render-show (:other shows-by-genre))]])])

(defn calendar [shows]
  (layout (show-table shows)))
