diff options
author | Robert Speicher <robert@gitlab.com> | 2016-08-19 17:42:26 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-08-19 17:42:26 +0000 |
commit | eae636edb4f01c7f8902856ca95fce7c8453a541 (patch) | |
tree | 1ff705c222b5ed6974e7cd4e3e15eb81041d9386 /app/models/concerns | |
parent | 66eb01853a15cf517341e91fdd10f6384fec80de (diff) | |
parent | c627dbc8fbf6f759dc9b40d75fa6fc9a435a461f (diff) | |
download | gitlab-ce-eae636edb4f01c7f8902856ca95fce7c8453a541.tar.gz |
Merge branch 'wall-clock-time-for-showing-pipeline' into 'master'
Show wall-clock time when showing pipeline
## What does this MR do?
Show wall-clock time when showing pipeline instead of cumulative builds time.
Closes #17007
See merge request !5734
Diffstat (limited to 'app/models/concerns')
-rw-r--r-- | app/models/concerns/statuseable.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/app/models/concerns/statuseable.rb b/app/models/concerns/statuseable.rb index 5d4b0a86899..750f937b724 100644 --- a/app/models/concerns/statuseable.rb +++ b/app/models/concerns/statuseable.rb @@ -35,11 +35,6 @@ module Statuseable all.pluck(self.status_sql).first end - def duration - duration_array = all.map(&:duration).compact - duration_array.reduce(:+) - end - def started_at all.minimum(:started_at) end @@ -85,4 +80,14 @@ module Statuseable def complete? COMPLETED_STATUSES.include?(status) end + + private + + def calculate_duration + if started_at && finished_at + finished_at - started_at + elsif started_at + Time.now - started_at + end + end end |