Memoize test_report_summary so we don't have to load it twice

Problem

We are loading the data for the test_report_summary twice in the test report controller.

Solution

We should memoize the test_report_summary so it does not get loaded twice on the test report summary page.

Original problem

### Problem

The new entity introduced in !35075 (merged) does not seem to be accessible by the frontend on the pipeline page: app/views/projects/pipelines/_with_tabs.html.haml ~L26

%span.badge.badge-pill.js-test-report-badge-counter= @pipeline.test_report_summary.total[:count]

Instead of @pipeline.test_report_summary.total[:count] we should be able to use @pipeline.tests_total_count or similar.

Solution

We need to introduce a new method within our PipelinePresenter which would expose the data to the frontend.

def tests_total_count
  strong_memoize(:tests_total_count) do
    pipeline.test_report_summary.total[:count]
  end
end

And change app/views/projects/pipelines/_with_tabs.html.haml ~L26 to %span.badge.badge-pill.js-test-report-badge-counter= @pipeline.test_total_count

Here an example implementation for failed_builds.

The following discussion from !39260 (merged) should be addressed:

cc @shampton

Edited by Ricky Wiens