                       (insert tracker (values {:tracker_code tracker-code
                                                :name (or tracker-name tracker-code)}))))))
 
+;; TODO needed
 (defn get-all-trackers []
   (select tracker)
   )

(ns ruuvi-server.database.event-dao
  (:require [ruuvi-server.configuration :as conf]
            [ruuvi-server.util :as util]
            [clojure.string :as string])
  (:use [korma.db :only (transaction)]
        [korma.core :only (select where insert update values
                                  set-fields with limit order fields)]


    (if (not (empty? conditions))
      (let [results (select event
                            (where (apply and conditions))
                            (order (order-by 0) (order-by 1))
                            (limit result-limit)) ]

        (map (fn [event]
               (let [event-id (:id event)
                     extra-data (cache/lookup cache-event-extra-data event-id
                                              get-event-extra-data)]
                 (merge event extra-data)
                 )) results)
        )
      '() )))

