]> source.dussan.org Git - redmine.git/commitdiff
Allow blank value for IssueStatus#default_done_ratio.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 12 Dec 2009 10:33:12 +0000 (10:33 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 12 Dec 2009 10:33:12 +0000 (10:33 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3157 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue.rb
app/models/issue_status.rb
app/views/issue_statuses/_form.rhtml

index 2062e58e8b0c198f34088b8b5e19fbba818611a6..c0cdac86ea87f6d6ef67fd09d3bfe4627d7ab3f3 100644 (file)
@@ -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
   
index a9c1db584c7649719818e92c4af5d0f5ddcf470d..fdda12a8c15f565490d44fe480491e3155a96f69 100644 (file)
@@ -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?
index e36dec8244745f5186ea5642c05d8da2413fbf64..20c333e0dd9f0ec88c2e428df10b756b943762c7 100644 (file)
@@ -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>