-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Recent job names from status resource".
This was meant to be used to solve the issue of stable job colors across graphs. Will have to wait for #31 possibly to be properly supported This reverts commit ae105b0.
- Loading branch information
Showing
2 changed files
with
7 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,15 @@ | ||
(ns buildviz.controllers.status | ||
(:require [buildviz.data.results :as results] | ||
[buildviz.util.http :as http] | ||
[clj-time | ||
[coerce :as tc] | ||
[core :as t]])) | ||
|
||
;; We manually calculate this period to be in sync with the JS implementation | ||
(def ^:private two-months (* 2 30 24 60 60 1000)) | ||
|
||
(defn- recent-jobs [all-builds] | ||
(let [two-months-ago (- (tc/to-long (t/now)) two-months)] | ||
(filter #(< two-months-ago (:start %)) | ||
all-builds))) | ||
|
||
(defn- build-starts [all-builds] | ||
(->> all-builds | ||
(map :start) | ||
(remove nil?))) | ||
[buildviz.util.http :as http])) | ||
|
||
(defn get-status [build-results pipeline-name] | ||
(let [all-builds (results/all-builds build-results) | ||
total-build-count (count all-builds) | ||
build-starts (seq (build-starts all-builds)) | ||
recent-job-names (->> (recent-jobs all-builds) | ||
(map :job) | ||
distinct | ||
seq)] | ||
build-starts (->> all-builds | ||
(map :start) | ||
(remove nil?) | ||
seq)] | ||
(http/respond-with-json (cond-> {:totalBuildCount total-build-count} | ||
pipeline-name (assoc :pipelineName pipeline-name) | ||
build-starts (assoc :latestBuildStart (apply max build-starts) | ||
:earliestBuildStart (apply min build-starts)) | ||
recent-job-names (assoc :recentJobNames recent-job-names))))) | ||
:earliestBuildStart (apply min build-starts)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters