UI: Ignore empty timestamps in build time calculation on buildset page

Currently, if a buildset contains at least one build without sufficient
time information (e.g. a SKIPPED build), this build will be shown as
"Starting build" with an "Invalid date". Additionally, the calculated
duration of such a buildset will always be shown as 0.

To fix this behaviour, we simply ignore missing timestamps when
trying to find the first and last build in the buildset.

Change-Id: I9a4479c913743ebf1fc8f0133f544362dcf61aaf
This commit is contained in:
Felix Edel committed 2021-10-20 09:21:24 +02:00
1 parent 22552b3ffa
commit 55242af7cb
1 file changed
+2 -2
+2 -2
View File
@@ -48,10 +48,10 @@ function Buildset({ buildset, timezone, tenant }) {
function renderBuildTimes() {
const firstStartBuild = buildset.builds.reduce((prev, cur) =>
prev.start_time < cur.start_time ? prev : cur
!cur.start_time || prev.start_time < cur.start_time ? prev : cur
)
const lastEndBuild = buildset.builds.reduce((prev, cur) =>
prev.end_time > cur.end_time ? prev : cur
!cur.end_time || prev.end_time > cur.end_time ? prev : cur
)
const totalDuration =
(moment.utc(lastEndBuild.end_time).tz(timezone) -