Commit f393a57a authored by Robert Speicher's avatar Robert Speicher

Merge branch 'mo-refactor-test-show-endpoint' into 'master'

Refactor test show endpoint

See merge request gitlab-org/gitlab!38809
parents d4765096 3ff27a70
......@@ -35,23 +35,19 @@ module Projects
# rubocop: disable CodeReuse/ActiveRecord
def builds
pipeline.latest_builds.where(id: build_params)
@builds ||= pipeline.latest_builds.for_ids(build_ids).presence || render_404
end
def build_params
def build_ids
return [] unless params[:build_ids]
params[:build_ids].split(",")
end
def test_suite
if builds.present?
builds.map do |build|
build.collect_test_reports!(Gitlab::Ci::Reports::TestReports.new)
end.sum
else
render_404
end
builds.map do |build|
build.collect_test_reports!(Gitlab::Ci::Reports::TestReports.new)
end.sum
end
# rubocop: enable CodeReuse/ActiveRecord
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