Project

General

Profile

Actions

Defect #26376

closed

Wrong issue counts and spent time on project overview

Defect #26376: Wrong issue counts and spent time on project overview

Added by Serhiy Yefremenko over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Category:
Projects
Target version:
Resolution:
Fixed
Affected version:

Description

After switching to 3.4.0 from 3.3.3 got the problem on project overview page. With non-admin user issue table is empty and total spent time is 0.0, even though "all issues" page and time report show correct data.
I saw related issues posted here but open new one because another version is affected and also because it seems to me that I found the reason.
I was able to trace the bug to the method User#project_ids_by_role, which returned wrong data. The actual reason lives in :visible scope of Project:

scope :visible, lambda {|*args| where(Project.visible_condition(args.shift || User.current, *args)) }

Because of this method chain, any query to Project from User#project_ids_by_role adds condition for parent id. So even if you place break point inside that method and call Project.first, you will get something like
SELECT * FROM Project WHERE project.id = ? LIMIT 1

Looks like it's a bug affecting ActiveRecord 4.2.8, discussed here:
https://github.com/rails/rails/issues/29445
https://github.com/rails/rails/issues/29338

The actual problem with missing issues and time can be solved commenting first line in User#project_ids_by_role (result caching) but it's not a valid solution. Also 3.3.3 and 3.3.4 seem to do same things but the bug is not reproduced on our data so we stick with 3.3.4 for now.


Related issues 3 (1 open — 2 closed)

Related to Redmine - Defect #25828: Issue visibility problems on 3.3.1NewActions
Has duplicate Redmine - Defect #26084: In my Overview column didn't show bugs countClosedActions
Has duplicate Redmine - Defect #26389: summary issue list disappeared from project overview pageClosedActions
Actions

Also available in: PDF Atom