@@ -1338,7 +1338,7 class Issue < ActiveRecord::Base | |||
|
1338 | 1338 | def recalculate_attributes_for(issue_id) |
|
1339 | 1339 | if issue_id && p = Issue.find_by_id(issue_id) |
|
1340 | 1340 | # priority = highest priority of children |
|
1341 |
if priority_position = p.children.maximum("#{IssuePriority.table_name}.position" |
|
|
1341 | if priority_position = p.children.joins(:priority).maximum("#{IssuePriority.table_name}.position") | |
|
1342 | 1342 | p.priority = IssuePriority.find_by_position(priority_position) |
|
1343 | 1343 | end |
|
1344 | 1344 | |
@@ -1357,8 +1357,9 class Issue < ActiveRecord::Base | |||
|
1357 | 1357 | if average == 0 |
|
1358 | 1358 | average = 1 |
|
1359 | 1359 | end |
|
1360 | done = p.leaves.sum("COALESCE(CASE WHEN estimated_hours > 0 THEN estimated_hours ELSE NULL END, #{average}) " + | |
|
1361 | "* (CASE WHEN is_closed = #{connection.quoted_true} THEN 100 ELSE COALESCE(done_ratio, 0) END)", :joins => :status).to_f | |
|
1360 | done = p.leaves.joins(:status). | |
|
1361 | sum("COALESCE(CASE WHEN estimated_hours > 0 THEN estimated_hours ELSE NULL END, #{average}) " + | |
|
1362 | "* (CASE WHEN is_closed = #{connection.quoted_true} THEN 100 ELSE COALESCE(done_ratio, 0) END)").to_f | |
|
1362 | 1363 | progress = done / (average * leaves_count) |
|
1363 | 1364 | p.done_ratio = progress.round |
|
1364 | 1365 | end |
General Comments 0
You need to be logged in to leave comments.
Login now