diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-05 12:38:00 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-05 12:38:00 +0200 |
commit | 361dc3641dd28c4ecefbda94f7a8dad299c349aa (patch) | |
tree | c2ac5788696ae8a16b82134bd92f5c6d37ef4e52 /app/models/ci/commit.rb | |
parent | 317a7469545d0e9a70e54a87a540b8aabe4c418b (diff) | |
download | gitlab-ce-361dc3641dd28c4ecefbda94f7a8dad299c349aa.tar.gz |
Fix builds_without_retry
Diffstat (limited to 'app/models/ci/commit.rb')
-rw-r--r-- | app/models/ci/commit.rb | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb index 59d4932d434..31da7e8f2b6 100644 --- a/app/models/ci/commit.rb +++ b/app/models/ci/commit.rb @@ -114,14 +114,11 @@ module Ci end def builds_without_retry - @builds_without_retry ||= - begin - grouped_builds = builds.group_by(&:name) - latest_builds = grouped_builds.map do |name, builds| - builds.sort_by(&:id).last - end - latest_builds.sort_by(&:stage_idx) - end + builds.latest + end + + def builds_without_retry_for_ref(ref) + builds.for_ref(ref).latest end def retried_builds @@ -181,7 +178,7 @@ module Ci end def duration_for_ref(ref) - builds_without_retry.for_ref(ref).select(&:duration).sum(&:duration).to_i + builds_without_retry_for_ref(ref).select(&:duration).sum(&:duration).to_i end def finished_at @@ -198,7 +195,7 @@ module Ci end def matrix_for_ref?(ref) - builds_without_retry.for_ref(ref).pluck(:id).size > 1 + builds_without_retry_for_ref(ref).pluck(:id).size > 1 end def config_processor |