Commit 2e9af7dc authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch 'coverage-badge-refactor' into 'master'

Pipeline helper method for Badge::Coverage::Report

See merge request gitlab-org/gitlab!46347
parents 071548ea f9c28fe4
...@@ -17,8 +17,6 @@ module Gitlab ...@@ -17,8 +17,6 @@ module Gitlab
key_width: opts[:key_width].to_i, key_width: opts[:key_width].to_i,
key_text: opts[:key_text] key_text: opts[:key_text]
} }
@pipeline = @project.ci_pipelines.latest_successful_for_ref(@ref)
end end
def entity def entity
...@@ -42,14 +40,18 @@ module Gitlab ...@@ -42,14 +40,18 @@ module Gitlab
private private
def pipeline
@pipeline ||= @project.ci_pipelines.latest_successful_for_ref(@ref)
end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def raw_coverage def raw_coverage
return unless @pipeline return unless pipeline
if @job.blank? if @job.blank?
@pipeline.coverage pipeline.coverage
else else
@pipeline.builds pipeline.builds
.find_by(name: @job) .find_by(name: @job)
.try(:coverage) .try(:coverage)
end end
......
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