Rename to total_duration and we're not using CommitStatus.duration

This commit is contained in:
Lin Jen-Shin 2016-08-15 18:54:38 +08:00
parent 7d9bdac6ce
commit 5e7d99d3dc
3 changed files with 3 additions and 9 deletions

View file

@ -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

View file

@ -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

View file

@ -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