summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-08-15 18:54:38 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-08-15 18:54:38 +0800
commit5e7d99d3dc3cc7c5cf644f15610ed9813b45cb41 (patch)
tree4a8fbf1f654be5cd0dafdeeac033d1e54643283a
parent7d9bdac6cef6c2e59c8d8753cd54bf5516bfdefc (diff)
downloadgitlab-ce-5e7d99d3dc3cc7c5cf644f15610ed9813b45cb41.tar.gz
Rename to total_duration and we're not using CommitStatus.duration
-rw-r--r--app/models/ci/pipeline.rb2
-rw-r--r--app/models/commit_status.rb5
-rw-r--r--app/views/projects/commit/_commit_box.html.haml5
3 files changed, 3 insertions, 9 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index a57ae0085ca..19335ccea57 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -78,7 +78,7 @@ module Ci
CommitStatus.where(pipeline: pluck(:id)).stages
end
- def self.duration
+ def self.total_duration
where.not(duration: nil).sum(:duration)
end
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index ac589fa2e31..9e1e9b76ce4 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -103,11 +103,6 @@ class CommitStatus < ActiveRecord::Base
end
end
- def self.duration
- select(:started_at, :finished_at).all.
- map(&:duration).compact.inject(0, &:+)
- end
-
def ignored?
allow_failure? && (failed? || canceled?)
end
diff --git a/app/views/projects/commit/_commit_box.html.haml b/app/views/projects/commit/_commit_box.html.haml
index 3ad866bb2f1..f733d49224e 100644
--- a/app/views/projects/commit/_commit_box.html.haml
+++ b/app/views/projects/commit/_commit_box.html.haml
@@ -57,9 +57,8 @@
= link_to builds_namespace_project_commit_path(@project.namespace, @project, @commit.id), class: "ci-status-link ci-status-icon-#{@commit.status}" do
= ci_icon_for_status(@commit.status)
= ci_label_for_status(@commit.status)
- - if @commit.pipelines.duration
- in
- = time_interval_in_words @commit.pipelines.duration
+ in
+ = time_interval_in_words @commit.pipelines.total_duration
.commit-box.content-block
%h3.commit-title