Index: app/helpers/reports_helper.rb =================================================================== --- app/helpers/reports_helper.rb (revision 2363) +++ app/helpers/reports_helper.rb (working copy) @@ -17,20 +17,16 @@ module ReportsHelper - def aggregate(data, criteria) - a = 0 + def aggregate_link(data, criteria, *args) + a,b = 0,0 data.each { |row| match = 1 criteria.each { |k, v| match = 0 unless (row[k].to_s == v.to_s) || (k == 'closed' && row[k] == (v == 0 ? "f" : "t")) } unless criteria.nil? - a = a + row["total"].to_i if match == 1 + a,b = a + row["total"].to_i, b+row["hours"].to_i if match == 1 } unless data.nil? - a - end - - def aggregate_link(data, criteria, *args) - a = aggregate data, criteria - a > 0 ? link_to(a, *args) : '-' + + a > 0 ? link_to(a.to_s + " (" + b.to_s + ")", *args) : '-' end end Index: app/controllers/issues_controller.rb =================================================================== --- app/controllers/issues_controller.rb (revision 2363) +++ app/controllers/issues_controller.rb (working copy) @@ -266,7 +266,7 @@ # Find potential statuses the user could be allowed to switch issues to @available_statuses = Workflow.find(:all, :include => :new_status, :conditions => {:role_id => current_role.id}).collect(&:new_status).compact.uniq.sort - @custom_fields = @project.issue_custom_fields.select {|f| f.field_format == 'list'} + @custom_fields = @project.all_issue_custom_fields.select {|f| f.field_format == 'list'} end def move Index: app/controllers/reports_controller.rb =================================================================== --- app/controllers/reports_controller.rb (revision 2363) +++ app/controllers/reports_controller.rb (working copy) @@ -134,7 +134,8 @@ ActiveRecord::Base.connection.select_all("select s.id as status_id, s.is_closed as closed, t.id as tracker_id, - count(i.id) as total + count(i.id) as total, + sum(i.estimated_hours) as hours from #{Issue.table_name} i, #{IssueStatus.table_name} s, #{Tracker.table_name} t where @@ -149,7 +150,8 @@ ActiveRecord::Base.connection.select_all("select s.id as status_id, s.is_closed as closed, v.id as fixed_version_id, - count(i.id) as total + count(i.id) as total, + sum(i.estimated_hours) as hours from #{Issue.table_name} i, #{IssueStatus.table_name} s, #{Version.table_name} v where @@ -164,7 +166,8 @@ ActiveRecord::Base.connection.select_all("select s.id as status_id, s.is_closed as closed, p.id as priority_id, - count(i.id) as total + count(i.id) as total, + sum(i.estimated_hours) as hours from #{Issue.table_name} i, #{IssueStatus.table_name} s, #{Enumeration.table_name} p where @@ -179,7 +182,8 @@ ActiveRecord::Base.connection.select_all("select s.id as status_id, s.is_closed as closed, c.id as category_id, - count(i.id) as total + count(i.id) as total, + sum(i.estimated_hours) as hours from #{Issue.table_name} i, #{IssueStatus.table_name} s, #{IssueCategory.table_name} c where @@ -194,7 +198,8 @@ ActiveRecord::Base.connection.select_all("select s.id as status_id, s.is_closed as closed, a.id as assigned_to_id, - count(i.id) as total + count(i.id) as total, + sum(i.estimated_hours) as hours from #{Issue.table_name} i, #{IssueStatus.table_name} s, #{User.table_name} a where @@ -209,7 +214,8 @@ ActiveRecord::Base.connection.select_all("select s.id as status_id, s.is_closed as closed, a.id as author_id, - count(i.id) as total + count(i.id) as total, + sum(i.estimated_hours) as hours from #{Issue.table_name} i, #{IssueStatus.table_name} s, #{User.table_name} a where @@ -224,7 +230,8 @@ ActiveRecord::Base.connection.select_all("select s.id as status_id, s.is_closed as closed, i.project_id as project_id, - count(i.id) as total + count(i.id) as total, + sum(i.estimated_hours) as hours from #{Issue.table_name} i, #{IssueStatus.table_name} s where Index: app/views/issues/_list.rhtml =================================================================== --- app/views/issues/_list.rhtml (revision 2363) +++ app/views/issues/_list.rhtml (working copy) @@ -19,4 +19,10 @@ <% end -%> +

+ Current page: <%= @issues.collect(&:estimated_hours).reject {|hours| hours.nil?}.sum %> + Total: <%= @estimated = Issue.sum :estimated_hours, + :include => [ :assigned_to, :status, :tracker, :project, :priority, :category, :fixed_version ], + :conditions => @query.statement %> +

<% end -%>