The organization UI does not sort the overall result before breaking results into pages

The organization UI does not sort the overall result before breaking results into pages. Instead its retrieving a page of results and applying the sort to that, which is misleading and useless.

For example, we have a few hundred projects. One of which is a program/script templates project thats naturally going to have lots of duplication. Its currently at about 70%. If I go to the organization project list and sort by duplication descending, this project does not show up in the list, because the sort is only being applied to the 1st page of results that I’m being shown. There’s no way to reliably see the worst or best for any one stat once you have more projects than the page size.

Not sure if entirely related but this is probably causing a problem for anyone using the project search web api as well. That also should be sorting before breaking the overall result into pages.

Hey,

Can you double check if there no new projects on the top of the list? "New” projects marked like this:
image

are always going to be the first level of sorting and inside each they are sorted by the specified sort property. If you are using API you can call it without specifying:

boostNewProjects

query parameter, and it should return correct order without making “NEW” projects appear on the top.

Best,
Marcin

1 Like

This is an easy repro. Were you not able to produce the same result or is the “new” projects interfering with your test set?

I dont have many “new” in my lists (like 1 or 2 out of a few hundred). They are not the problem.

The url that the network tab hits is https://sonarcloud.io/api/components/search_projects?boostNewProjects=true&ps=50&facets=reliability_rating%2Csecurity_rating%2Csqale_rating%2Ccoverage%2Cduplicated_lines_density%2Cncloc%2Calert_status%2Clanguages%2Ctags&f=analysisDate%2CleakPeriodDate&organization=REDACTED&s=coverage&asc=false

Its getting that 50 page size and sorting those, not sorting all projects and getting the top 50.

This UI is the only out of the box way for companies to get any kind of report or overall view of the state of projects. “Where do we need to focus on to improve quality?” shouldnt be a hard question to answer.

Hi @StingyJack,

I was not able to produce the same results, it works as expected. I sent you a private message to ask for the organization key, so I can reproduce the bug more precisely.

You can see it working correctly on Apache Foundation page: https://sonarcloud.io/organizations/apache/projects?sort=-coverage

Best,
Marcin

1 Like

Org key sent.

I’m not an admin on the Apache project so I cant use the Web API to get the list of all projects and stats to use as a comparison