diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-11-06 12:24:16 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-11-06 12:24:16 +0200 |
commit | ad8892a97aa74ca7dcc6aae790de9f2ca6df1943 (patch) | |
tree | e14268a1beaf02a5f37c98ed16bd8055382a016b /app/models/commit.rb | |
parent | 8bf9b7e99a998bb86ee7522e657fced7ee77c025 (diff) | |
download | gitlab-ci-ad8892a97aa74ca7dcc6aae790de9f2ca6df1943.tar.gz |
Fix commit duration and cancel status
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index 184d3a0..6568e34 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -108,6 +108,8 @@ class Commit < ActiveRecord::Base 'pending' elsif running? 'running' + elsif canceled? + 'canceled' else 'failed' end @@ -135,12 +137,14 @@ class Commit < ActiveRecord::Base status == 'failed' end - # TODO: implement def canceled? + builds_without_retry.all? do |build| + build.canceled? + end end def duration - @duration ||= builds.select(&:finished_at).sum(&:duration) + @duration ||= builds.select(&:finished_at).sum(&:duration).to_i end def finished_at |