Project

General

Profile

Actions

Defect #21449

open

Automatic done ratio calculation in issue tree is wrong when parent has its own estimated time

Added by Sebastian Paluch almost 9 years ago. Updated about 4 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Issues
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

Due to the change in r14272 estimated_hours are now independent for parent and subtasks. But, it seems that automatic calculation of done ratio is still based on estimated time of children, ignoring value provided for the parent.

e.g.

  • A (2h)
    • B (2h)
      • C (2h) 50% done

This results with 50% done ratio on all tasks up to A, what, from estimated time point of view, is wrong - only 1 of 6 hours is "done".

I do not see a fix for this when automatic done ratio calculation is enabled as there is no way to say that some work on parent has been also done. Anyway, latest changes leads to inconsistency


Related issues

Related to Redmine - Defect #16092: Parent/subtask: calculation of estimated hoursClosed

Actions
Actions #1

Updated by Toshi MARUYAMA almost 9 years ago

  • Related to Defect #16092: Parent/subtask: calculation of estimated hours added
Actions #2

Updated by Sebastian Paluch over 4 years ago

This issue still exists in Redmine 4.1.0 and this is big issue. Don't know why none complains about this.

Actions #3

Updated by Sebastian Paluch about 4 years ago

It seems that the equation in recalculate_attributes_for has to be changed to include the estimate time of the issue to:


          total_estimated = p.estimated_hours.to_f || 0.0
          children = p.children.to_a
          if children.any?
            if p.closed?
              p.done_ratio = 100
            else
              done = children.map {|c|
                estimated = c.total_estimated_hours.to_f
                total_estimated += estimated
                ratio = c.closed? ? 100 : (c.done_ratio || 0)
                estimated * ratio / 100.0
              }.sum
              progress = ((total_estimated - done) / total_estimated) * 100
              p.done_ratio = 100 - progress.floor
            end
            # ancestors will be recursively updated
            p.save(:validate => false)
          end

The problem with this is that this will correctly update "% Done" of all parents (A) recursively but it will not update "% Done" of currently edited issue (B) if the issue is also a parent (for C).

I have tried moving this recalculation to before_save callback, so that it can modify the issue (B) and this works correctly, "% Done" of current issue (B) and all parents (A) is updated.

This creates though small inconsistency in journals. Normally updates to derived "% Done" are not save into journal. But in the case, when issues (B) is edited and it has derived "% Done" (because it is parent for C), the new "% Done" value gets saved into journal. This is not OK as the "% Done" may be changed at any time if any subtask (C) is modified - since this operation is not be saved in journal, now the issue (B) shows different value of "% Done" then visible in last journal entry. So, confusing. And I don't know how to solve this problem.

Actions

Also available in: Atom PDF