I have a user with 180 violations assigned, but the widget only shows he has 39. Several other users also have wrong counts. The log of the database statements revealed the problem. The query to get the reviews before counting for each developer is:
So basically i only see a selection of the last 200 violations. At least this is deterministic and does not change each time, but it is still plain wrong.
/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb always adds a :limit => 200 option to the query, so even if i want to search for all reviews, i only get 200. This might be ok for the review management pages, where i can refine the query, but it is not in the widget, where it generates quite random data.
I would suggest adding the following query to review.rb:
which would also eliminate the code to sort out the numbers.