Defect #6310

done ratio is not correct in one of the situations

Added by Kiwamu Kato about 7 years ago. Updated about 7 years ago.

Status:ClosedStart date:2010-09-06
Priority:NormalDue date:
Assignee:Eric Davis% Done:

0%

Category:-
Target version:-
Resolution:Duplicate Affected version:

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

Duplicates Redmine - Defect #5170: Done ratio can not revert to 0% if status is used for don... Closed 2010-03-24

History

#1 Updated by Mischa The Evil about 7 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...

#2 Updated by Felix Schäfer about 7 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

Closing as a duplicate of #5170, will post a patch soon there.

Also available in: Atom PDF