diff --git a/redmine/app/controllers/reports_controller.rb b/redmine/app/controllers/reports_controller.rb index 6e5726329..4a2f7972e 100644 --- a/redmine/app/controllers/reports_controller.rb +++ b/redmine/app/controllers/reports_controller.rb @@ -41,13 +41,21 @@ class ReportsController < ApplicationController @data = issues_by_category @report_title = l(:field_category) render :template => "reports/issue_report_details" + when "author" + @field = "author_id" + @rows = @project.members.collect { |m| m.user } + @data = issues_by_author + @report_title = l(:field_author) + render :template => "reports/issue_report_details" else @trackers = Tracker.find(:all) @priorities = Enumeration::get_values('IPRI') @categories = @project.issue_categories + @authors = @project.members.collect { |m| m.user } issues_by_tracker issues_by_priority issues_by_category + issues_by_author render :template => "reports/issue_report" end end @@ -101,5 +109,20 @@ private and i.category_id=c.id and i.project_id=#{@project.id} group by s.id, s.is_closed, c.id") + end + + def issues_by_author + @issues_by_author ||= + 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 + from + issues i, issue_statuses s, users a + where + i.status_id=s.id + and i.author_id=a.id + and i.project_id=#{@project.id} + group by s.id, s.is_closed, a.id") end end diff --git a/redmine/app/models/user.rb b/redmine/app/models/user.rb index 5ff19f2bc..7f09ef550 100644 --- a/redmine/app/models/user.rb +++ b/redmine/app/models/user.rb @@ -85,6 +85,10 @@ class User < ActiveRecord::Base firstname + " " + lastname end + def name + display_name + end + def active? self.status == STATUS_ACTIVE end diff --git a/redmine/app/views/reports/issue_report.rhtml b/redmine/app/views/reports/issue_report.rhtml index f4704969b..e2f8a844d 100644 --- a/redmine/app/views/reports/issue_report.rhtml +++ b/redmine/app/views/reports/issue_report.rhtml @@ -8,6 +8,10 @@ <%=l(:field_priority)%> <%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>

<%= link_to l(:label_details), :detail => 'priority' %> 

+ +<%=l(:field_author)%> +<%= render :partial => 'simple', :locals => { :data => @issues_by_author, :field_name => "author_id", :rows => @authors } %> +

<%= link_to l(:label_details), :detail => 'author' %>