Project

General

Profile

Change version completed percent calculation

Added by Renato Cherini about 11 years ago

Hello everyone.

I organize issues in a tree hierarchy, using different trackers for "internal" issues (i.e. issues used to group some others), and "leaves" issues. Usually, an internal issue has no 'done ratio' set, so it is inherited from its children that are also leaves (it is calculated as the average). This is very useful for me. However, the calculation of completed percent of versions is quite different. It is calculated as the average of done ratio of every issue, not taking into account if an issue is a leaf or a internal node (whose done ratio is in turn the average of done ratio of its children). In this way, the completed percent is not representative. The done ratio of a leaf is possibly considered several times depending of the hierarchy depth.

I'm interested in changing this behavior. The completed percent of a version is done calling to issues_progress function of line 276 of version.rb (in app/model). The relevant code is the following:

done = fixed_issues.open(open).sum("COALESCE(estimated_hours, #{estimated_average}) * #{ratio}").to_f
progress = done / (estimated_average * issues_count)

Basically it calculates the average of the ratio of all issues (open and closed ones). I should change it to consider only leaves issues. However I'm a ruby newbie, so I will really appreciate if someone could give me a hint about how to change the code in a minimal way.

Thanks.