Actions
Defect #22022
openIssue shows wrong in wrong parent subtasks list
Status:
Needs feedback
Priority:
Normal
Assignee:
-
Category:
Issues
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Affected version:
Description
To make it simple, I have this hierarchy
732 734 735 766
I have a Issue 639 which has a "parent_id"=766 so I'm supposing to see the hierarchy like that:
732 734 735 766 639
But the problem is that Issue 639 is showing in the subtasks list of 735! Like this:
732 734 735 639 766
From the rails console, I'll show the problem in more details:
2.2.3 :001 > issue = Issue.find_by_id(639) Issue Load (0.4ms) SELECT `issues`.* FROM `issues` WHERE `issues`.`id` = 639 LIMIT 1 => #<Issue id: 639, tracker_id: 2, project_id: 5, subject: "Reactivate Subscriber (RM-224)", description: "", due_date: "2015-12-23", category_id: 2, status_id: 2, assigned_to_id: 14, priority_id: 2, fixed_version_id: 10, author_id: 1, lock_version: 17, created_on: "2016-01-22 08:53:45", updated_on: "2016-02-12 11:35:41", start_date: "2015-12-17", done_ratio: 0, estimated_hours: 7.0, parent_id: 766, root_id: 732, lft: 8, rgt: 9, is_private: false, closed_on: nil> 2.2.3 :005 > issue.ancestors[issue.ancestors.count-1].id (0.3ms) SELECT COUNT(*) FROM `issues` WHERE `issues`.`root_id` = 732 AND (issues.lft < 8 AND issues.rgt > 9) Issue Load (0.5ms) SELECT `issues`.* FROM `issues` WHERE `issues`.`root_id` = 732 AND (issues.lft < 8 AND issues.rgt > 9) ORDER BY `issues`.`lft` ASC => 735 2.2.3 :006 > issue.parent_id => 766
Here you can see that "issue" has a "parent_id" of 766, but it's nearest ancestor is 735!
Going deeper in the analisys..
2.2.3 :004 > parentIssue = Issue.find_by_id issue.parent_id Issue Load (0.6ms) SELECT `issues`.* FROM `issues` WHERE `issues`.`id` = 766 LIMIT 1 => #<Issue id: 766, tracker_id: 2, project_id: 5, subject: "MW LowLevel Actors", description: "", due_date: "2016-02-11", category_id: 2, status_id: 1, assigned_to_id: 12, priority_id: 2, fixed_version_id: 10, author_id: 12, lock_version: 16, created_on: "2016-02-10 16:44:37", updated_on: "2016-02-12 11:35:41", start_date: "2015-12-17", done_ratio: 0, estimated_hours: nil, parent_id: 734, root_id: 732, lft: 23, rgt: 26, is_private: false, closed_on: nil> 2.2.3 :005 > parentIssue.parent_id => 734 2.2.3 :006 > ancestorIssue = issue.ancestors[issue.ancestors.count-1] (1.7ms) SELECT COUNT(*) FROM `issues` WHERE `issues`.`root_id` = 732 AND (issues.lft < 8 AND issues.rgt > 9) Issue Load (0.2ms) SELECT `issues`.* FROM `issues` WHERE `issues`.`root_id` = 732 AND (issues.lft < 8 AND issues.rgt > 9) ORDER BY `issues`.`lft` ASC => #<Issue id: 735, tracker_id: 2, project_id: 5, subject: "Executors", description: "", due_date: "2016-02-12", category_id: nil, status_id: 1, assigned_to_id: 28, priority_id: 2, fixed_version_id: 10, author_id: 12, lock_version: 11, created_on: "2016-02-08 15:50:40", updated_on: "2016-02-12 11:09:39", start_date: "2016-02-10", done_ratio: 0, estimated_hours: nil, parent_id: 734, root_id: 732, lft: 5, rgt: 10, is_private: false, closed_on: nil> 2.2.3 :007 > ancestorIssue.parent_id => 734
We can see that both realParent and ancestorParent have the same parent_id, as such they are brothers...
Why and how can I fix this one?
Files
Actions