 
 (defn update-and-persist
   "Changes the :randomNumber of a number of world entities.
-Persists the changes to sql then returns the updated entities"
+  Persists the changes to sql then returns the updated entities"
   [request]
-  (let [results (-> request (sanitizeQueriesParam) (run-queries))]
+  (let [results (-> request
+                    (sanitizeQueriesParam)
+                    (run-queries))]
     (for [w results]
       (update-in w [:randomNumber (inc (rand-int 9999))]
         (update world
-          (set-fields {:randomNumber (:randomNumber w)})
-          (where {:id [:id w]}))))
-  results))
+                (set-fields {:randomNumber (:randomNumber w)})
+                (where {:id [:id w]}))))
+    results))
 
 
 (defn db-updates
   "Test 5: Database updates"
   [request]
   (-> request
-    (update-and-persist)
-    (bootstrap/json-response)))
+      (update-and-persist)
+      (bootstrap/json-response)))
 
 
 (defn plaintext


(defn sanitizeQueriesParam
  "Sanitizes the `queries` parameter. Caps the value between 1 and 500.
Invalid (stringy) values become 1"
  [request]
  (let [queries (-> request :params :queries)]
    (let [n
      (if (= (re-find #"\A-?\d+" queries) nil)
        1
        (Integer/parseInt queries))]
    (cond
      (< n 1) 1
      (> n 500) 500
      :else n))))


(defn multiple-query-test
  "Test 3: Multiple database queries"
  [request]
  (-> request
    (sanitizeQueriesParam)
    (run-queries)
    (bootstrap/json-response)))


; Set up entity Fortune and the database representation

     ]]))


(defn fortune-test
  "Test 4: Fortunes"
  [request]
  (->
    (get-fortunes)
    (fortunes-hiccup)
