プロジェクト

全般

プロフィール

Vote #67259

完了

Update_parent_attributes doesn't work for the old parent issue when reparenting

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
高め
担当者:
-
カテゴリ:
Issues_2
対象バージョン:
開始日:
2010/05/14
期日:
進捗率:

100%

予定工数:
category_id:
2
version_id:
14
issue_org_id:
5524
author_id:
12746
assigned_to_id:
5
comments:
6
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

Try the following scenario:

  • Create issue "Parent 1"
  • Create issue "Parent 2"
  • Create subissue "Child" on "Parent 2" and set its estimated hours to 5

Current situation: Parent 1: 0hrs, Parent 2: 5 hrs, Child: 5 hrs

Now change parent for Child to "Parent 1"

Current situation: Parent 1: 5hrs, Parent 2: 5 hrs, Child: 5 hrs


journals

I think this could be solved by doing something like the following when an issue is saved:

if <issue has parent> and <new parent != current parent>
p = <parent>
c = <children excluding tree starting at issue being reparented>
l = <leaves excluding tree starting at issue being reparented>
<update parent attributes as usual>
end

this will not disturb the usual workflow, and will work even if the issue being reparented is the last sub issue on its parent. I just don't know where to stick this behaviour.
--------------------------------------------------------------------------------
I had expected the following to work:

before_save :store_parent
after_save :fix_old_parent

def store_parent
if self.parent_id_was && !(self.parent_id_was == self.parent_issue_id)
@old_parent = self.parent_id_was
else
@old_parent = nil
end
end

def fix_old_parent
if @old_parent
dummy_child = Issue.new (:parent_id => @old_parent)
dummy_child.instance_eval { update_parent_attributes }
end
end

I can see the methods being called when I add logging, but the estimated hours remain as they are.
--------------------------------------------------------------------------------
Reproduced here on current trunk. I leave a patch to solve this problem, a unit test included, all tests passing succesfully on my config.

Emiliano: maybe you can apply this and see if it works for you..
--------------------------------------------------------------------------------
Seems to do the job for me. Is there a timeline for this to be included in RM trunk?
--------------------------------------------------------------------------------
My best bet to get this merged would be Eric Davis, though he is under a lot of stress from his work and redmine at the moment. I think this is important enough that it should be fixed for 1.0.0 though.
--------------------------------------------------------------------------------
Applied in r3821. Thank you for the test in the patch, I had trouble understanding what this bug was doing until I read the test case.
--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

  • カテゴリIssues_2 にセット
  • 対象バージョン1.0.0 (RC)_14 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0