summaryrefslogtreecommitdiff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-08-19 17:42:26 +0000
committerRobert Speicher <robert@gitlab.com>2016-08-19 17:42:26 +0000
commiteae636edb4f01c7f8902856ca95fce7c8453a541 (patch)
tree1ff705c222b5ed6974e7cd4e3e15eb81041d9386 /app/models/concerns
parent66eb01853a15cf517341e91fdd10f6384fec80de (diff)
parentc627dbc8fbf6f759dc9b40d75fa6fc9a435a461f (diff)
downloadgitlab-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.rb15
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