Commit a2d4ca09 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

issues report by author

git-svn-id: http://redmine.rubyforge.org/svn/trunk@35 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 7473be40
...@@ -41,13 +41,21 @@ class ReportsController < ApplicationController ...@@ -41,13 +41,21 @@ class ReportsController < ApplicationController
@data = issues_by_category @data = issues_by_category
@report_title = l(:field_category) @report_title = l(:field_category)
render :template => "reports/issue_report_details" 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 else
@trackers = Tracker.find(:all) @trackers = Tracker.find(:all)
@priorities = Enumeration::get_values('IPRI') @priorities = Enumeration::get_values('IPRI')
@categories = @project.issue_categories @categories = @project.issue_categories
@authors = @project.members.collect { |m| m.user }
issues_by_tracker issues_by_tracker
issues_by_priority issues_by_priority
issues_by_category issues_by_category
issues_by_author
render :template => "reports/issue_report" render :template => "reports/issue_report"
end end
end end
...@@ -101,5 +109,20 @@ private ...@@ -101,5 +109,20 @@ private
and i.category_id=c.id and i.category_id=c.id
and i.project_id=#{@project.id} and i.project_id=#{@project.id}
group by s.id, s.is_closed, c.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
end end
...@@ -85,6 +85,10 @@ class User < ActiveRecord::Base ...@@ -85,6 +85,10 @@ class User < ActiveRecord::Base
firstname + " " + lastname firstname + " " + lastname
end end
def name
display_name
end
def active? def active?
self.status == STATUS_ACTIVE self.status == STATUS_ACTIVE
end end
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
<strong><%=l(:field_priority)%></strong> <strong><%=l(:field_priority)%></strong>
<%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %> <%= 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> <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>
<div class="splitcontentright"> <div class="splitcontentright">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment