]> source.dussan.org Git - redmine.git/commitdiff
issues report by author
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 21 Oct 2006 15:41:42 +0000 (15:41 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 21 Oct 2006 15:41:42 +0000 (15:41 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@35 e93f8b46-1217-0410-a6f0-8f06a7374b81

redmine/app/controllers/reports_controller.rb
redmine/app/models/user.rb
redmine/app/views/reports/issue_report.rhtml

index 6e5726329cbf8f10aaf6ae49812ce5ed1f895de7..4a2f7972e0e4162ee98a77f6c0e3c649d72f0ef8 100644 (file)
@@ -41,13 +41,21 @@ class ReportsController < ApplicationController
       @data = issues_by_category\r
       @report_title = l(:field_category)\r
       render :template => "reports/issue_report_details"   \r
+    when "author"\r
+      @field = "author_id"\r
+      @rows = @project.members.collect { |m| m.user }\r
+      @data = issues_by_author\r
+      @report_title = l(:field_author)\r
+      render :template => "reports/issue_report_details"  \r
     else\r
       @trackers = Tracker.find(:all)\r
       @priorities = Enumeration::get_values('IPRI')\r
       @categories = @project.issue_categories\r
+      @authors = @project.members.collect { |m| m.user }\r
       issues_by_tracker\r
       issues_by_priority\r
       issues_by_category\r
+      issues_by_author\r
       render :template => "reports/issue_report"\r
     end\r
   end  \r
@@ -101,5 +109,20 @@ private
                                                   and i.category_id=c.id\r
                                                   and i.project_id=#{@project.id}\r
                                                 group by s.id, s.is_closed, c.id")     \r
+       end\r
+       \r
+       def issues_by_author\r
+    @issues_by_author ||= \r
+      ActiveRecord::Base.connection.select_all("select    s.id as status_id, \r
+                                                  s.is_closed as closed, \r
+                                                  a.id as author_id,\r
+                                                  count(i.id) as total \r
+                                                from \r
+                                                  issues i, issue_statuses s, users a\r
+                                                where \r
+                                                  i.status_id=s.id \r
+                                                  and i.author_id=a.id\r
+                                                  and i.project_id=#{@project.id}\r
+                                                group by s.id, s.is_closed, a.id")     \r
        end
 end
index 5ff19f2bc9cae9e2dcfc43d1acfab807dc6ec8b7..7f09ef550d14ac1f2ca6dc98465a5073159845f8 100644 (file)
@@ -85,6 +85,10 @@ class User < ActiveRecord::Base
     firstname + " " + lastname\r
   end\r
   \r
+  def name\r
+    display_name\r
+  end\r
+  \r
   def active?\r
     self.status == STATUS_ACTIVE\r
   end\r
index f4704969bb3ea22b3731d1e4696d18e16a66ec86..e2f8a844ddc7d9900c8a9e8119d4592ee7a9ee53 100644 (file)
@@ -8,6 +8,10 @@
 <strong><%=l(:field_priority)%></strong>\r
 <%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>\r
 <p align="right"><small><%= link_to l(:label_details), :detail => 'priority' %></small>&nbsp;</p>\r
+\r
+<strong><%=l(:field_author)%></strong>\r
+<%= render :partial => 'simple', :locals => { :data => @issues_by_author, :field_name => "author_id", :rows => @authors } %>\r
+<p align="right"><small><%= link_to l(:label_details), :detail => 'author' %></small>&nbsp;</p>\r
 </div>\r
 \r
 <div class="splitcontentright">\r