Feature #21450 » Add Total Estimated Time on Group Options.patch
| issue_query.rb (working copy) | ||
|---|---|---|
| 38 | 38 |
QueryColumn.new(:total_estimated_hours, |
| 39 | 39 |
:sortable => "COALESCE((SELECT SUM(estimated_hours) FROM #{Issue.table_name} subtasks" +
|
| 40 | 40 |
" WHERE subtasks.root_id = #{Issue.table_name}.root_id AND subtasks.lft >= #{Issue.table_name}.lft AND subtasks.rgt <= #{Issue.table_name}.rgt), 0)",
|
| 41 |
:default_order => 'desc'), |
|
| 41 |
:default_order => 'desc', :totalable => true),
|
|
| 42 | 42 |
QueryColumn.new(:done_ratio, :sortable => "#{Issue.table_name}.done_ratio", :groupable => true),
|
| 43 | 43 |
QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on", :default_order => 'desc'),
|
| 44 | 44 |
QueryColumn.new(:closed_on, :sortable => "#{Issue.table_name}.closed_on", :default_order => 'desc'),
|
| ... | ... | |
| 322 | 322 |
map_total(scope.sum(:estimated_hours)) {|t| t.to_f.round(2)}
|
| 323 | 323 |
end |
| 324 | 324 | |
| 325 |
# Returns sum of all the issue's total estimated_hours |
|
| 326 |
def total_for_total_estimated_hours(scope) |
|
| 327 |
total = scope.sum("COALESCE((SELECT SUM(estimated_hours) FROM #{Issue.table_name} subtasks" +
|
|
| 328 |
" WHERE subtasks.root_id = #{Issue.table_name}.root_id AND subtasks.lft >= #{Issue.table_name}.lft AND subtasks.rgt <= #{Issue.table_name}.rgt), 0)")
|
|
| 329 | ||
| 330 |
|
|
| 331 |
map_total(total) {|t| t.to_f.round(2)}
|
|
| 332 |
end |
|
| 333 | ||
| 325 | 334 |
# Returns sum of all the issue's time entries hours |
| 326 | 335 |
def total_for_spent_hours(scope) |
| 327 | 336 |
total = if group_by_column.try(:name) == :project |