summaryrefslogtreecommitdiff
path: root/app/models/ci
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/ci')
-rw-r--r--app/models/ci/pipeline.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 08b104ccfc8..5b9754b5c37 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -78,6 +78,10 @@ module Ci
CommitStatus.where(pipeline: pluck(:id)).stages
end
+ def self.total_duration
+ where.not(duration: nil).sum(:duration)
+ end
+
def project_id
project.id
end
@@ -246,7 +250,7 @@ module Ci
end
def update_duration
- self.duration = statuses.latest.duration
+ self.duration = calculate_duration
end
def execute_hooks