Defect #6310
closeddone ratio is not correct in one of the situations
0%
Description
I noticed that done ratio is not correct in the situation.
Setting of Calculate the issue done ratio with: "Use the issue status".
Status %Done New 0 In Progress 10
1. Create issue with "New" status, then done ratio is 0%.
2. Change issue status to "In Progress", then done ratio is 10%.
3. Change back issue status to "New", then done ratio is NOT 0% but 10%.
4. On [Administration] -> [Issue Statuses], execute "Update issue done ratios", then done ration is 0%.
This is why IssueStatus#default_done_ratio? method returns false when default_done_ratio is ZERO.
I checked it trunk head and tags 1.0.1.
% ruby script/console Loading development environment (Rails 2.3.5) >> IssueStatus.find_by_name("New").default_done_ratio? => false >> IssueStatus.find_by_name("In Progress").default_done_ratio? => true
A simple patch is below.
% svn diff Index: app/models/issue.rb =================================================================== --- app/models/issue.rb (revision xxx) +++ app/models/issue.rb (working copy) @@ -245,7 +245,7 @@ end def done_ratio - if Issue.use_status_for_done_ratio? && status && status.default_done_ratio? + if Issue.use_status_for_done_ratio? && status && !status.default_done_ratio.nil? status.default_done_ratio else read_attribute(:done_ratio)
Thank you.
Kiwamu Kato
Related issues
Updated by Mischa The Evil over 14 years ago
- Assignee set to Eric Davis
Eric, can you take a look at this? I remember that you've written the code for the "Setting of Calculate the issue done ratio with: "Use the issue status""-feature...
Updated by Felix Schäfer over 14 years ago
- Status changed from New to Closed
- Resolution set to Duplicate
Closing as a duplicate of #5170, will post a patch soon there.