         (dom/h3 nil (str "Mark " (:round/recall selected-activity) " of "
                          (count
                            (:round/starting selected-activity))))
-        (dom/h3 nil (str "Heats " (:round/heats selected-activity)))
-        (dom/h3 nil (str "Example Participant " (:participant/number (first (:round/starting selected-activity)))))))))
+        ((om/factory HeatsComponent) {:participants (:round/starting selected-activity)
+                                      :heats (:round/heats selected-activity)})
+        ;(dom/h3 nil (str "Example Participant " (:participant/number
+        ;                                          (first (:round/starting selected-activity)))))
+        ))))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Components


;; TODO:
;; Data needed from the back end:
; - Judge info
; - Round name
; - Participants to be marked

;; TODO:
;; - Select judge for UI
;; X Get selected round that is to be judged
;; - Get the number of participants to be recalled
;; - Show participant number
;; - Command to set mark on participant for the specific round for this judge
;; - Command to inc/dec the judges 'point' for a participant

                                                      :app/selected-adjudicator])))}
                 (:adjudicator/name %)) (:adjudicator-panel/adjudicators panel)))))))

;(defn positions
;  [pred coll]
;  (keep-indexed (fn [idx x]
;                  (when (pred x)
;                    idx))
;                coll))

;(fn [idx x] (str idx)) (partition-all (int (Math/ceil (/ 40 7))) (range 1 41)))
(defui HeatComponent
  static om/IQuery
  (query [_])
  Object
  (render [this]
    (let [heat (:heat (om/props this))
          participants (:participants (om/props this))]
      (dom/div nil (str "Heat : " heat)))))

(defui HeatsComponent
  static om/IQuery
  (query [_]
    [:participant/id :participant/number])
  Object
  (render [this]
    (let [participants (:participants (om/props this))
          heats (:heats (om/props this))
          heat-parts (partition-all (int (Math/ceil (/ (count participants) heats))) participants)]
      (dom/div nil
        (dom/h3 nil (str "Heats : " heats))
        (map-indexed (fn [idx parts] ((om/factory HeatComponent)
                                       {:heat idx
                                        :participants parts}))
                     heat-parts)))))

(defui MainComponent
  static om/IQuery
  (query [_]
    [{:app/selected-activity
      [:activity/id :activity/name
       :round/recall :round/heats :round/name
       {:round/starting (om/get-query HeatsComponent)}
       {:round/panel (om/get-query AdjudicatorSelection)}]}
     {:app/selected-adjudicator [:adjudicator/name
                                 :adjudicator/id]}])
