# 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
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?
<% 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>