 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+(defn str-contains
+  "Check whether the first string contains the second string"
+  [stack needle]
+  (< -1 (.indexOf stack needle)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defonce next-task-id (atom 0))
+(defonce next-card-id (atom 0))
+
 (defn create-task
   "Create a task to display in a card"
-  [id name done]
-  {:task-id id
+  [name done]
+  (swap! next-task-id inc)
+  {:task-id @next-task-id
    :name name
    :done done})
 
 (defn create-card
   "Create a card to display in the dash-board"
-  [id title description category status & tasks]
-  {:card-id id
+  [title description category status & tasks]
+  (swap! next-card-id inc)
+  {:card-id @next-card-id
    :title title
    :description description
    :category category

   [:ul
    (for [t tasks]
      ^{:key (:task-id t)} [render-task t])]
   [:input.checklist--add-task
    {:type "text" :placeholder "Type then hit Enter to add a task"}]
  ])

(defn card-side-color
  [card]
  {:position "absolute" :zindex -1 :top 0 :bottom 0 :left 0 :width 5
   :backgroundColor (-> card :category category->color)

         [:div.card__details
          (:description card)
          [render-tasks (:tasks card)]
          [:input.checklist--add-task
           {:type "text"
            :placeholder "Type then hit Enter to add a task"
            :on-key-press #(add-task (:card-id card) %)}]
         ])
       ])
    ))
