Commit f9c28fe4 authored by drew cimino's avatar drew cimino

Pipeline helper method for Badge::Coverage::Report

parent c1ef6a80
...@@ -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