Feature #5490 » issue5490.patch
app/models/issue.rb (working copy) | ||
---|---|---|
315 | 315 |
end |
316 | 316 | |
317 | 317 |
unless leaf? |
318 |
attrs.reject! {|k,v| %w(priority_id done_ratio start_date due_date estimated_hours).include?(k)} |
|
318 |
#attrs.reject! {|k,v| %w(priority_id done_ratio start_date due_date estimated_hours).include?(k)}
|
|
319 | 319 |
end |
320 | 320 | |
321 | 321 |
if attrs['parent_issue_id'].present? |
... | ... | |
816 | 816 | |
817 | 817 |
def recalculate_attributes_for(issue_id) |
818 | 818 |
if issue_id && p = Issue.find_by_id(issue_id) |
819 |
# priority = highest priority of children |
|
820 |
if priority_position = p.children.maximum("#{IssuePriority.table_name}.position", :joins => :priority) |
|
821 |
p.priority = IssuePriority.find_by_position(priority_position) |
|
822 |
end |
|
823 | ||
824 |
# start/due dates = lowest/highest dates of children |
|
825 |
p.start_date = p.children.minimum(:start_date) |
|
826 |
p.due_date = p.children.maximum(:due_date) |
|
827 |
if p.start_date && p.due_date && p.due_date < p.start_date |
|
828 |
p.start_date, p.due_date = p.due_date, p.start_date |
|
829 |
end |
|
830 | ||
831 | 819 |
# done ratio = weighted average ratio of leaves |
832 | 820 |
unless Issue.use_status_for_done_ratio? && p.status && p.status.default_done_ratio |
833 | 821 |
leaves_count = p.leaves.count |
app/views/issues/_attributes.html.erb (working copy) | ||
---|---|---|
8 | 8 |
<% end %> |
9 | 9 | |
10 | 10 |
<% if @issue.safe_attribute? 'priority_id' %> |
11 |
<p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), {:required => true}, :disabled => !@issue.leaf? %></p>
|
|
11 |
<p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), {:required => true} %></p> |
|
12 | 12 |
<% end %> |
13 | 13 | |
14 | 14 |
<% if @issue.safe_attribute? 'assigned_to_id' %> |
... | ... | |
45 | 45 |
<% end %> |
46 | 46 | |
47 | 47 |
<% if @issue.safe_attribute? 'start_date' %> |
48 |
<p><%= f.text_field :start_date, :size => 10, :disabled => !@issue.leaf? %><%= calendar_for('issue_start_date') if @issue.leaf? %></p>
|
|
48 |
<p><%= f.text_field :start_date, :size => 10 %><%= calendar_for('issue_start_date') %></p>
|
|
49 | 49 |
<% end %> |
50 | 50 | |
51 | 51 |
<% if @issue.safe_attribute? 'due_date' %> |
52 |
<p><%= f.text_field :due_date, :size => 10, :disabled => !@issue.leaf? %><%= calendar_for('issue_due_date') if @issue.leaf? %></p>
|
|
52 |
<p><%= f.text_field :due_date, :size => 10 %><%= calendar_for('issue_due_date') %></p>
|
|
53 | 53 |
<% end %> |
54 | 54 | |
55 | 55 |
<% if @issue.safe_attribute? 'estimated_hours' %> |