 (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)]

      (let [failures (map #(failures-for build-results %) job-names)]
        (http/respond-with-json (into {} (apply merge failures))))
      (http/respond-with-csv (csv/export-table ["failedCount" "job" "testsuite" "classname" "name"]
                                          (mapcat #(failures-as-list build-results %) job-names))))))

;; testsuites


   (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!)
