 (defn inputs
   "Construct url to retrieve tiles for algorithm input"
   [{:keys [x y algorithm] :as data}]
-  (let [conf  (get-conf (:algorithm data))
+  (let [conf  (get-conf algorithm)
         now   (tc/to-string (time/now))]
     (template/render (:inputs_url_template conf) (merge data {:now now}))))
 


(defn disable
  "Disables an algorithm in the system"
  [^String algorithm]
  (->> algorithm
       (event/destroy-exchange)
       (event/destroy-queue)))


(defn get-conf
  "Retrieve algorithm configuration or nil"
  [algorithm]
  (->> (hayt/where [[= :algorithm algorithm]])
       (hayt/select :algorithms)
       (db/execute)
       (first)))
