mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
fix: ui: calculate build running time
This commit is contained in:
parent
f758fc6412
commit
85d70266d9
1 changed files with 3 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue