 (ns lambdacd.presentation.pipeline-state
+  "This namespace contains functions useful to convert the internal state of a pipeline into something more easy to use
+  for further processing, e.g. to present it to a user.
+
+  Functions taking a map step-id to step-result are usually called with the result of `lambdacd.state.core/get-step-results`"
   (:require [clj-time.core :as t]
             [clojure.tools.logging :as log]
             [clj-timeframes.core :as tf]

(defn- step-result [[_ step-result]]
  step-result)

(defn overall-build-status [step-ids-and-results]
  (let [accumulated-status (->> step-ids-and-results
                                (filter root-step?)
                                (sort-by root-step-id)

(defn- interval-duration [interval]
  (t/in-seconds interval))

(defn build-duration
  "Takes a map of step-ids to step results and returns the duration of a build in seconds (excluding time the build spent waiting)"
  [step-ids-and-results]
  (->> step-ids-and-results
       (vals)
       (filter not-waiting?)
