 (defn- serialize-nested-testsuites [testsuite-id]
   (join ": " testsuite-id))
 
-(defn- comma-separated-test-runtimes [job]
+(defn- flat-test-runtimes [job]
   (->> (testsuites/average-testsuite-runtime-as-list (test-runs job))
        (map (fn [{testsuite :testsuite classname :classname name :name average-runtime :averageRuntime}]
-              (join [(csv/export [average-runtime
-                                  job
-                                  (serialize-nested-testsuites testsuite)
-                                  classname
-                                  name])
-                     "\n"])))))
+              [average-runtime
+               job
+               (serialize-nested-testsuites testsuite)
+               classname
+               name]))))
 
 (defn- has-testsuites? [job]
   (some? (@test-results job)))

  (let [job-names (filter has-testsuites? (keys @builds))]
    (if (= (:mime accept) :json)
      {:body (zipmap job-names (map testsuites-for job-names))}
      {:body (join (cons "averageRuntime,job,testsuite,classname,name\n"
                         (mapcat comma-separated-test-runtimes job-names)))})))

;; app


        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
                                                          (:averageRuntime job)
                                                          (:totalCount job)
                                                          (:failedCount job)
                                                          (:flakyCount job)])
                                    buildSummary))})))

;; fail phases

