Commit 5cd504ed authored by Kamil Trzcinski's avatar Kamil Trzcinski

Rename builds_without_retry to latest_builds

parent 2e9c1608
...@@ -48,7 +48,7 @@ module Ci ...@@ -48,7 +48,7 @@ module Ci
end end
def retry def retry
builds_without_retry.each do |build| latest_builds.each do |build|
Ci::Build.retry(build) Ci::Build.retry(build)
end end
end end
...@@ -113,12 +113,12 @@ module Ci ...@@ -113,12 +113,12 @@ module Ci
@latest_statuses ||= statuses.latest.to_a @latest_statuses ||= statuses.latest.to_a
end end
def builds_without_retry def latest_builds
@builds_without_retry ||= builds.latest.to_a @latest_builds ||= builds.latest.to_a
end end
def builds_without_retry_for_ref(ref) def latest_builds_for_ref(ref)
builds_without_retry.select { |build| build.ref == ref } latest_builds.select { |build| build.ref == ref }
end end
def retried def retried
...@@ -181,7 +181,7 @@ module Ci ...@@ -181,7 +181,7 @@ module Ci
def coverage def coverage
if project.coverage_enabled? if project.coverage_enabled?
coverage_array = builds_without_retry.map(&:coverage).compact coverage_array = latest_builds.map(&:coverage).compact
if coverage_array.size >= 1 if coverage_array.size >= 1
'%.2f' % (coverage_array.reduce(:+) / coverage_array.size) '%.2f' % (coverage_array.reduce(:+) / coverage_array.size)
end end
...@@ -189,7 +189,7 @@ module Ci ...@@ -189,7 +189,7 @@ module Ci
end end
def matrix_for_ref?(ref) def matrix_for_ref?(ref)
builds_without_retry_for_ref(ref).size > 1 latest_builds_for_ref(ref).size > 1
end end
def config_processor def config_processor
......
...@@ -49,7 +49,7 @@ module Ci ...@@ -49,7 +49,7 @@ module Ci
commit = build.commit commit = build.commit
return unless commit return unless commit
return unless commit.builds_without_retry.include? build return unless commit.latest_builds.include? build
case commit.status.to_sym case commit.status.to_sym
when :failed when :failed
......
...@@ -48,7 +48,7 @@ module Ci ...@@ -48,7 +48,7 @@ module Ci
# it doesn't make sense to send emails for retried builds # it doesn't make sense to send emails for retried builds
commit = build.commit commit = build.commit
return unless commit return unless commit
return unless commit.builds_without_retry.include?(build) return unless commit.latest_builds.include?(build)
case build.status.to_sym case build.status.to_sym
when :failed when :failed
......
...@@ -23,7 +23,7 @@ module Ci ...@@ -23,7 +23,7 @@ module Ci
def attachments def attachments
fields = [] fields = []
commit.builds_without_retry.each do |build| commit.latest_builds.each do |build|
next if build.allow_failure? next if build.allow_failure?
next unless build.failed? next unless build.failed?
fields << { fields << {
......
...@@ -48,7 +48,7 @@ module Ci ...@@ -48,7 +48,7 @@ module Ci
commit = build.commit commit = build.commit
return unless commit return unless commit
return unless commit.builds_without_retry.include?(build) return unless commit.latest_builds.include?(build)
case commit.status.to_sym case commit.status.to_sym
when :failed when :failed
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#up-build-trace #up-build-trace
- if @commit.matrix_for_ref?(@build.ref) - if @commit.matrix_for_ref?(@build.ref)
%ul.center-top-menu.build-top-menu %ul.center-top-menu.build-top-menu
- @commit.builds_without_retry_for_ref(@build.ref).each do |build| - @commit.latest_builds_for_ref(@build.ref).each do |build|
%li{class: ('active' if build == @build) } %li{class: ('active' if build == @build) }
= link_to namespace_project_build_path(@project.namespace, @project, build) do = link_to namespace_project_build_path(@project.namespace, @project, build) do
= ci_icon_for_status(build.status) = ci_icon_for_status(build.status)
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
= build.id = build.id
- unless @commit.builds_without_retry_for_ref(@build.ref).include?(@build) - unless @commit.latest_builds_for_ref(@build.ref).include?(@build)
%li.active %li.active
%a %a
Build ##{@build.id} Build ##{@build.id}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment