diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2009-12-11 18:48:34 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2009-12-11 18:48:34 +0000 |
commit | 4fe14e71c2d76a2e92da0aaa71e18493d65b1fc1 (patch) | |
tree | 0ef000f0e3985772228928b0acdca1a292f82ef6 /app/models/issue_status.rb | |
parent | a83501364d0aa5e5e6d7a9e4ccfa2be5dab555b0 (diff) | |
download | redmine-4fe14e71c2d76a2e92da0aaa71e18493d65b1fc1.tar.gz redmine-4fe14e71c2d76a2e92da0aaa71e18493d65b1fc1.zip |
Adds a Setting to control how an Issue's done_ratio is calculated:
* Issue field (default) - the done_ratio field for the Issue
* Issue status - uses the Issue Status's value
#4274
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3151 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue_status.rb')
-rw-r--r-- | app/models/issue_status.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/issue_status.rb b/app/models/issue_status.rb index ca33d37d6..a9c1db584 100644 --- a/app/models/issue_status.rb +++ b/app/models/issue_status.rb @@ -33,6 +33,18 @@ class IssueStatus < ActiveRecord::Base def self.default find(:first, :conditions =>["is_default=?", true]) end + + # Update all the +Issues+ setting their done_ratio to the value of their +IssueStatus+ + def self.update_issue_done_ratios + if Issue.use_status_for_done_ratio? + IssueStatus.find(:all, :conditions => ["default_done_ratio >= 0"]).each do |status| + Issue.update_all(["done_ratio = ?", status.default_done_ratio], + ["status_id = ?", status.id]) + end + end + + return Issue.use_status_for_done_ratio? + end # Returns an array of all statuses the given role can switch to # Uses association cache when called more than one time |