@@ -817,7 +817,7 class Issue < ActiveRecord::Base | |||||
817 | def recalculate_attributes_for(issue_id) |
|
817 | def recalculate_attributes_for(issue_id) | |
818 | if issue_id && p = Issue.find_by_id(issue_id) |
|
818 | if issue_id && p = Issue.find_by_id(issue_id) | |
819 | # priority = highest priority of children |
|
819 | # priority = highest priority of children | |
820 |
if priority_position = p.children.maximum("#{IssuePriority.table_name}.position", : |
|
820 | if priority_position = p.children.maximum("#{IssuePriority.table_name}.position", :joins => :priority) | |
821 | p.priority = IssuePriority.find_by_position(priority_position) |
|
821 | p.priority = IssuePriority.find_by_position(priority_position) | |
822 | end |
|
822 | end | |
823 |
|
823 | |||
@@ -836,7 +836,7 class Issue < ActiveRecord::Base | |||||
836 | if average == 0 |
|
836 | if average == 0 | |
837 | average = 1 |
|
837 | average = 1 | |
838 | end |
|
838 | end | |
839 |
done = p.leaves.sum("COALESCE(estimated_hours, #{average}) * (CASE WHEN is_closed = #{connection.quoted_true} THEN 100 ELSE COALESCE(done_ratio, 0) END)", : |
|
839 | done = p.leaves.sum("COALESCE(estimated_hours, #{average}) * (CASE WHEN is_closed = #{connection.quoted_true} THEN 100 ELSE COALESCE(done_ratio, 0) END)", :joins => :status).to_f | |
840 | progress = done / (average * leaves_count) |
|
840 | progress = done / (average * leaves_count) | |
841 | p.done_ratio = progress.round |
|
841 | p.done_ratio = progress.round | |
842 | end |
|
842 | end |
General Comments 0
You need to be logged in to leave comments.
Login now