summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-12 10:33:12 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-12 10:33:12 +0000
commitd905f2ce7eb210811e84cd5227b864bce7e187c2 (patch)
tree059674bf7e23e1940ace612be35353f5383dfc65
parentd72778619f6b06ec86a7ac0be49d42885acdf640 (diff)
downloadredmine-d905f2ce7eb210811e84cd5227b864bce7e187c2.tar.gz
redmine-d905f2ce7eb210811e84cd5227b864bce7e187c2.zip
Allow blank value for IssueStatus#default_done_ratio.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3157 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/issue.rb4
-rw-r--r--app/models/issue_status.rb1
-rw-r--r--app/views/issue_statuses/_form.rhtml2
3 files changed, 4 insertions, 3 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 2062e58e8..c0cdac86e 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -220,8 +220,8 @@ class Issue < ActiveRecord::Base
# Set the done_ratio using the status if that setting is set. This will keep the done_ratios
# even if the user turns off the setting later
def update_done_ratio_from_issue_status
- if Issue.use_status_for_done_ratio? && !self.status.default_done_ratio.blank?
- self.done_ratio = self.status.default_done_ratio
+ if Issue.use_status_for_done_ratio? && status && status.default_done_ratio?
+ self.done_ratio = status.default_done_ratio
end
end
diff --git a/app/models/issue_status.rb b/app/models/issue_status.rb
index a9c1db584..fdda12a8c 100644
--- a/app/models/issue_status.rb
+++ b/app/models/issue_status.rb
@@ -24,6 +24,7 @@ class IssueStatus < ActiveRecord::Base
validates_uniqueness_of :name
validates_length_of :name, :maximum => 30
validates_format_of :name, :with => /^[\w\s\'\-]*$/i
+ validates_inclusion_of :default_done_ratio, :in => 0..100, :allow_nil => true
def after_save
IssueStatus.update_all("is_default=#{connection.quoted_false}", ['id <> ?', id]) if self.is_default?
diff --git a/app/views/issue_statuses/_form.rhtml b/app/views/issue_statuses/_form.rhtml
index e36dec824..20c333e0d 100644
--- a/app/views/issue_statuses/_form.rhtml
+++ b/app/views/issue_statuses/_form.rhtml
@@ -7,7 +7,7 @@
<% if Issue.use_status_for_done_ratio? %>
<p><label for="issue_done_ratio"><%=l(:field_done_ratio)%></label>
-<%= select 'issue_status', :default_done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p>
+<%= select 'issue_status', :default_done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }), :include_blank => true %></p>
<% end %>
<p><label for="issue_status_is_closed"><%=l(:field_is_closed)%></label>