 (defn- failures-for [build-results job-name]
   (when-some [test-results (results/chronological-tests build-results job-name)]
     (when-some [failed-tests (seq (testsuites/accumulate-testsuite-failures
-                                  (map junit-xml/parse-testsuites test-results)))]
+                                   (map junit-xml/parse-testsuites test-results)))]
       (let [build-data-entries (results/builds build-results job-name)]
         {job-name (merge {:children failed-tests}
-                    (failed-count-for build-data-entries))}))))
+                         (failed-count-for build-data-entries))}))))
 
 (defn- failures-as-list [build-results job-name]
   (when-some [test-results (results/chronological-tests build-results job-name)]


(defn- remap-date-first [[job runtimes-by-day]]
  (map (fn [[day avg-runtime]]
              [day {job avg-runtime}])
            runtimes-by-day))

(defn- merge-runtimes [all-runtimes-by-day]
  (->> (mapcat remap-date-first all-runtimes-by-day)

   (GET "/testcases" {accept :accept} (get-testcases build-results accept))
   (GET "/testcases.csv" {} (get-testcases build-results {:mime :csv}))
   (GET "/testclasses" {accept :accept} (get-testclasses build-results accept))
   (GET "/testclasses.csv" {} (get-testclasses build-results {:mime :csv}))))

(defn create-app [build-results persist-jobs! persist-tests!]
  (-> (app-routes build-results persist-jobs! persist-tests!)
