Defect #26085

Subtasks are not assigning to correct parent

Added by Mark Wintch over 4 years ago. Updated almost 4 years ago.

Status:Needs feedbackStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues
Target version:-
Resolution: Affected version:3.3.0

Description

To replicate the issue one needs to:
  • 1. Create a level 1 issue. This will be the parent of all other issues. Let's call it Issue #100
  • 2. Then create any number greater than 1 subtasks of that parent. We will create five and say they are issue ID's 110, 120, 130, 140, and 150.
  • 3. Now under issue ID create a subtask with issue ID 111. That will work fine.
  • Here comes the problem:
  • 4. Move 111 to 150 and it will be abandoned.
  • 5. Move 111 to 140 and it will say 140 is the parent, but it will actually be placed under 150.

Looking at the issues table in SQL the problem seems to be that the lft and rgt fields do not increment when adding the new subtask to a new parent that did not have tasks previously. So, the new task fails over to the next available range of lft rgt bounds. If there is no parent to that range then the issue is orphaned, otherwise it assigns the issue to the next range available, but not the one that the user desires even though the application will say the tasks is a child of the correct parent.


Our current workaround is as follows using the example from above:
Edit issue 140 or 150 whichever you are working with as follows. Remove the parent of 100 and set it to blank and save. Then edit issue 111 so that it has no parent and save it. Go back to issue 140 or 150 and set the parent to 100 and save it. Then go to issue 111 and assign to either 140 or 150 and it will now work.

Environment:
  Redmine version                3.3.0.stable
  Ruby version                   2.1.8-p440 (2015-12-16) [x64-mingw32]
  Rails version                  4.2.6
  Environment                    production
  Database adapter               SQLServer
SCM:
  Filesystem
Redmine plugins:
  redmine_agile                  1.4.1

2017-12-05 04.43.26 pm.jpg (491 KB) Vitaly Maslov, 2017-12-05 12:56

2017-12-05 04.44.28 pm.jpg (491 KB) Vitaly Maslov, 2017-12-05 12:56

2017-12-05 04.46.47 pm.jpg (119 KB) Vitaly Maslov, 2017-12-05 12:56

2017-12-05 04.46.13 pm.jpg (504 KB) Vitaly Maslov, 2017-12-05 12:56

after.png (13.6 KB) Toshi MARUYAMA, 2017-12-28 17:59

before.png (13.9 KB) Toshi MARUYAMA, 2017-12-28 17:59

History

#1 Updated by Mischa The Evil over 4 years ago

  • Description updated (diff)

I've edited the description to increase the readability of the issue.

Mark Wintch wrote:

  • 3. Now under issue ID create a subtask with issue ID 111. That will work fine.

For clarity's sake: what will be the parent of issue with ID 111 after this third step? Is it 110, 120, 130, 140, or 150? Or is it 100?

#2 Updated by Mark Wintch over 4 years ago

Thank you for making this report more readable and catching what I overlooked.

In step 3: 3. Now under issue ID create a subtask with issue ID 111. That will work fine. The parent would be 110 because in the example I was creating it under the first second level subtask created. It could be created under any of the issues 110, 120, 130, 140 or 150 and it would work fine in that case. The problem occurs when moving from a subtask to a new subtask which previously had no other subtasks assigned to it.

Edited by Mischa The Evil: corrected a typo.

#3 Updated by Mischa The Evil over 4 years ago

  • Status changed from New to Needs feedback

Mark Wintch wrote:

In step 3: 3. Now under issue ID create a subtask with issue ID 111. That will work fine. The parent would be 110 because in the example I was creating it under the first second level subtask created. It could be created under any of the issues 110, 120, 130, 140 or 150 and it would work fine in that case. The problem occurs when moving from a subtask to a new subtask which previously had no other subtasks assigned to it.

Two things:
  • by moving you actually mean: changing the parent value of the existing issue?
  • I wasn't able to reproduce this issue on source:/trunk@16580 without the redmine_agile plugin installed.
I'd suggest you to test:
  • without the redmine_agile plugin (v1.4.1) installed
  • with the current version of the redmine_agile plugin (v1.4.3) installed
  • with the last released Redmine version installed (v3.3.3), both without and with the (latest version of the) redmine_agile plugin.

#4 Updated by Vitaly Maslov about 4 years ago

Hello,

Redmine 3.3.3. Same issue and reproduced ok.

1. Created a level 1 issue. "100", task #8396
2. Create 5 subtasks: "110", "120", "130", "140", "150". Tasks #8397 - #8401.
3. Under issue "110" created a subtask "111", task #8402. Tree looks Ok.
4. Change parent of the issue "111" from "110" to "140" (from task #8397 to #8400). Parent has changed to task #4000 in DB, but issue is tied to task #4001 ("150") in issue view.

Screens are attached. You can see that parent_id is correct but lft and rgt were calculated incorrectly.

This issue is related to #22022, probably.

#5 Updated by Toshi MARUYAMA almost 4 years ago

Vitaly Maslov wrote:

Hello,

Redmine 3.3.3. Same issue and reproduced ok.

I cannot reproduce on my CentOS 7 postgresql-server-9.2.23-3.el7_4.x86_64.

Environment:
  Redmine version                3.3.5.stable
  Ruby version                   2.2.7-p470 (2017-03-28) [x86_64-linux]
  Rails version                  4.2.7.1
  Environment                    production
  Database adapter               PostgreSQL
SCM:
  Subversion                     1.7.14
  Mercurial                      2.8.2
  Git                            1.8.3.1
  Filesystem               

redmine-test-3.3-stable=> select id, subject, parent_id, root_id, lft, rgt from issues order by id desc;
 id | subject | parent_id | root_id | lft | rgt 
----+---------+-----------+---------+-----+-----
 14 | 111     |         9 |       8 |   3 |   4
 13 | 150     |         8 |       8 |  12 |  13
 12 | 140     |         8 |       8 |  10 |  11
 11 | 130     |         8 |       8 |   8 |   9
 10 | 120     |         8 |       8 |   6 |   7
  9 | 110     |         8 |       8 |   2 |   5
  8 | 100     |           |       8 |   1 |  14

redmine-test-3.3-stable=> select id, subject, parent_id, root_id, lft, rgt from issues order by id desc;
 id | subject | parent_id | root_id | lft | rgt 
----+---------+-----------+---------+-----+-----
 14 | 111     |        12 |       8 |   9 |  10
 13 | 150     |         8 |       8 |  12 |  13
 12 | 140     |         8 |       8 |   8 |  11
 11 | 130     |         8 |       8 |   6 |   7
 10 | 120     |         8 |       8 |   4 |   5
  9 | 110     |         8 |       8 |   2 |   3
  8 | 100     |           |       8 |   1 |  14

Also available in: Atom PDF