       (let [build-data-entries (vals (@builds job))]
         {job (merge {:children failed-tests}
                     (failed-count-for build-data-entries))}))))
-
-(defn- serialize-nested-testsuites [testsuite-id]
-  (join ": " testsuite-id))
 
 (defn- failures-as-list [job]
   (when-let [test-results (@test-results job)]

        buildSummaries (map summary-for jobNames)
        buildSummary (zipmap jobNames buildSummaries)]
    (if (= (:mime accept) :json)
      {:body buildSummary}
      {:body (csv/export-table ["job" "averageRuntime" "totalCount" "failedCount" "flakyCount"]
                               (map (fn [[job-name job]] [job-name
                                                          (csv/format-duration (:averageRuntime job))
                                                          (:totalCount job)
                                                          (:failedCount job)
                                                          (:flakyCount job)])
                                    buildSummary))})))

;; fail phases


  (let [jobs (keys @builds)]
    (if (= (:mime accept) :json)
      (let [failures (map failures-for jobs)]
        (respond-with-json (into {} (apply merge failures))))
      (respond-with-csv (csv/export-table ["failedCount" "job" "testsuite" "classname" "name"]
                                          (mapcat failures-as-list jobs))))))

;; testsuites

