fix: ui: calculate build running time

This commit is contained in:
6543 2022-01-31 16:58:11 +01:00
parent f758fc6412
commit 85d70266d9
No known key found for this signature in database
GPG key ID: C99B82E40B027BAE

View file

@ -42,15 +42,12 @@ export default (build: Ref<Build | undefined>) => {
const start = build.value.started_at || 0;
const end = build.value.finished_at || build.value.updated_at || 0;
if (start === 0) {
if (start === 0 || end === 0) {
return 0;
}
if (end === 0) {
// only calculate time on running builds
if (build.value.status !== 'running') {
return 0;
}
// only calculate time based no now() for running builds
if (build.value.status === 'running') {
return Date.now() - start * 1000;
}