summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-08-15 18:50:02 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-08-15 18:50:02 +0800
commit7d9bdac6cef6c2e59c8d8753cd54bf5516bfdefc (patch)
tree08504abfc58e0aef7b8dac67c90ab5283846d1b4
parent47ed793af9430eb9dd6b2ae957e16d07cdd360b4 (diff)
downloadgitlab-ce-7d9bdac6cef6c2e59c8d8753cd54bf5516bfdefc.tar.gz
We could just sum with SQL
-rw-r--r--app/models/ci/pipeline.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 581acdf8e51..a57ae0085ca 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -79,7 +79,7 @@ module Ci
end
def self.duration
- where.not(duration: nil).pluck(:duration).inject(0, &:+)
+ where.not(duration: nil).sum(:duration)
end
def project_id