issues report by author

git-svn-id: http://redmine.rubyforge.org/svn/trunk@35 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2006-10-21 15:41:42 +00:00
parent 7473be4072
commit a2d4ca095a
3 changed files with 31 additions and 0 deletions

View File

@ -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

View File

@ -85,6 +85,10 @@ class User < ActiveRecord::Base
firstname + " " + lastname
end
def name
display_name
end
def active?
self.status == STATUS_ACTIVE
end

View File

@ -8,6 +8,10 @@
<strong><%=l(:field_priority)%></strong>
<%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>
<p align="right"><small><%= link_to l(:label_details), :detail => 'priority' %></small>&nbsp;</p>
<strong><%=l(:field_author)%></strong>
<%= render :partial => 'simple', :locals => { :data => @issues_by_author, :field_name => "author_id", :rows => @authors } %>
<p align="right"><small><%= link_to l(:label_details), :detail => 'author' %></small>&nbsp;</p>
</div>
<div class="splitcontentright">