Fix query parameters for downloading group projects coverage report
Summary
The endpoint for downloading a group coverage CSV report should look like this:
https://gitlab.com/groups/gitlab-org/-/analytics/coverage_reports.csv?ref_path=refs%2Fheads%2Fmaster&start_date=2020-08-22&end_date=2020-09-21&project_ids[]=<id>&project_ids[]=<id>
Note that the project_ids
parameter takes the param[]=value¶m[]=value
approach.
Currently this feature is creating the endpoint to be like this:
https://gitlab.com/groups/gitlab-org/-/analytics/coverage_reports.csv?ref_path=refs%2Fheads%2Fmaster&start_date=2020-08-22&end_date=2020-09-21&project_ids=<id>,<id>
Where the IDs are comma separated in the same parameter.
This causes the query parameter to be useless and the endpoint just returns the report for all of the projects in the group.
Steps to reproduce
- Go to a group's
/analytics/repository_analytics
page and click on theDownload historic test coverage data (.csv)
button. - In the modal, select a couple projects in the projects dropdown.
- Click
Download test coverage data (.csv)
- Select a different set of projects to download
- Click
Download test coverage data (.csv)
again - Note that the report shows the same data
Example Project
What is the current bug behavior?
The endpoint just returns the report for all of the projects in the group regardless of which projects are selected.
What is the expected correct behavior?
The endpoint should return a report for only the projects you select.
Possible fixes
We just need to change the query parameters to be in the format required (project_ids[]=value&project_ids[]=value
)