Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-3404

Wrong number of reviews is displayed in "Open reviews per developer" widget

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.13
    • Fix Version/s: 3.0
    • Component/s: Issues
    • Labels:
      None

      Description

      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:

      SELECT * FROM "reviews" WHERE (project_id in (1) AND status in ('OPEN','REOPENED'))  ORDER BY reviews.updated_at DESC LIMIT 200
      

      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:

      select login, count(*) as cnt from reviews join users u on (assignee_id=u.id)
      where status in('OPEN', 'REOPENED')
      group by u.login
      order by cnt desc
      

      which would also eliminate the code to sort out the numbers.

        Attachments

          Activity

            People

            Assignee:
            simon.brandhof Simon Brandhof (Inactive)
            Reporter:
            rbrindl Ronald Brindl
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: