Project

General

Profile

Open issues in project overview shows wrong count

Added by Henk Smits over 14 years ago

Dear all,

In the projectoverview there's a box titled "issue tracking" and it states the count for open and closed issues. Although my project has over 20 open issues and about 300 closed ones, the box says "Bug: 0 open / 1".
I traced down the sql which is causing the problem and is stated below:

SELECT count(DISTINCT "issues".id) AS count_all, tracker_id AS tracker_id FROM "issues" LEFT OUTER JOIN "projects" ON "projects".id = "issues".project_id LEFT OUTER JOIN "issue_statuses" ON "issue_statuses".id = "issues".status_id LEFT OUTER JOIN "trackers" ON "trackers".id = "issues".tracker_id WHERE (((projects.id = 17 OR (projects.lft > 25 AND projects.rgt < 26))) AND issue_statuses.is_closed='f') AND (projects.status=1 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='issue_tracking')) GROUP BY tracker_id

If i put this query directly into my postgresql server, it shows 1 as a result for count_all. If i however remove the part of the where clause thats saying "AND projects.id IN (SELECT...", the result for count_all is correct. If i put in the subquery (SELECT em.project_id FROM ...) it shows a list of projectid's including projectid 17.

Could someone explain to me why this is not working?

Thanks in advance, Jasper