Commit f910931a authored by Simon Lenz's avatar Simon Lenz Committed by Kerri Miller

Return only the latest build with coverage in MR widget JSON

parent d4628f0c
......@@ -875,7 +875,7 @@ module Ci
end
def builds_with_coverage
builds.with_coverage
builds.latest.with_coverage
end
def has_reports?(reports_scope)
......
---
title: Do not show retried builds in the MR code coverage
merge_request: 42402
author: Simon Lenz @koala7
type: fixed
......@@ -3628,6 +3628,16 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
expect(builds).to include(rspec, jest)
expect(builds).not_to include(karma)
end
it 'returns only latest builds' do
obsolete = create(:ci_build, name: "jest", coverage: 10.12, pipeline: pipeline, retried: true)
retried = create(:ci_build, name: "jest", coverage: 20.11, pipeline: pipeline)
builds = pipeline.builds_with_coverage
expect(builds).to include(retried)
expect(builds).not_to include(obsolete)
end
end
describe '#base_and_ancestors' do
......
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