@@ -47,16 +47,24 class ReportsController < ApplicationController | |||
|
47 | 47 | @data = issues_by_author |
|
48 | 48 | @report_title = l(:field_author) |
|
49 | 49 | render :template => "reports/issue_report_details" |
|
50 | when "subproject" | |
|
51 | @field = "project_id" | |
|
52 | @rows = @project.children | |
|
53 | @data = issues_by_subproject | |
|
54 | @report_title = l(:field_subproject) | |
|
55 | render :template => "reports/issue_report_details" | |
|
50 | 56 | else |
|
51 | 57 | @queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)] |
|
52 | 58 | @trackers = Tracker.find(:all, :order => 'position') |
|
53 | 59 | @priorities = Enumeration::get_values('IPRI') |
|
54 | 60 | @categories = @project.issue_categories |
|
55 | 61 | @authors = @project.members.collect { |m| m.user } |
|
62 | @subprojects = @project.children | |
|
56 | 63 | issues_by_tracker |
|
57 | 64 | issues_by_priority |
|
58 | 65 | issues_by_category |
|
59 | 66 | issues_by_author |
|
67 | issues_by_subproject | |
|
60 | 68 | @total_hours = @project.time_entries.sum(:hours) |
|
61 | 69 | render :template => "reports/issue_report" |
|
62 | 70 | end |
@@ -165,4 +173,19 private | |||
|
165 | 173 | and i.project_id=#{@project.id} |
|
166 | 174 | group by s.id, s.is_closed, a.id") |
|
167 | 175 | end |
|
176 | ||
|
177 | def issues_by_subproject | |
|
178 | @issues_by_subproject ||= | |
|
179 | ActiveRecord::Base.connection.select_all("select s.id as status_id, | |
|
180 | s.is_closed as closed, | |
|
181 | i.project_id as project_id, | |
|
182 | count(i.id) as total | |
|
183 | from | |
|
184 | #{Issue.table_name} i, #{IssueStatus.table_name} s | |
|
185 | where | |
|
186 | i.status_id=s.id | |
|
187 | and i.project_id IN (#{@project.children.collect{|p| p.id}.join(',')}) | |
|
188 | group by s.id, s.is_closed, i.project_id") if @project.children.any? | |
|
189 | @issues_by_subproject ||= [] | |
|
190 | end | |
|
168 | 191 | end |
@@ -15,28 +15,28 | |||
|
15 | 15 | <tbody> |
|
16 | 16 | <% for row in rows %> |
|
17 | 17 | <tr class="<%= cycle("odd", "even") %>"> |
|
18 | <td><%= link_to row.name, :controller => 'projects', :action => 'list_issues', :id => @project, | |
|
18 | <td><%= link_to row.name, :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)), | |
|
19 | 19 | :set_filter => 1, |
|
20 | 20 | "#{field_name}" => row.id %></td> |
|
21 | 21 | <% for status in @statuses %> |
|
22 | 22 | <td align="center"><%= link_to (aggregate data, { field_name => row.id, "status_id" => status.id }), |
|
23 | :controller => 'projects', :action => 'list_issues', :id => @project, | |
|
23 | :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)), | |
|
24 | 24 | :set_filter => 1, |
|
25 | 25 | "status_id" => status.id, |
|
26 | 26 | "#{field_name}" => row.id %></td> |
|
27 | 27 | <% end %> |
|
28 | 28 | <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 0 }), |
|
29 | :controller => 'projects', :action => 'list_issues', :id => @project, | |
|
29 | :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)), | |
|
30 | 30 | :set_filter => 1, |
|
31 | 31 | "#{field_name}" => row.id, |
|
32 | 32 | "status_id" => "o" %></td> |
|
33 | 33 | <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }), |
|
34 | :controller => 'projects', :action => 'list_issues', :id => @project, | |
|
34 | :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)), | |
|
35 | 35 | :set_filter => 1, |
|
36 | 36 | "#{field_name}" => row.id, |
|
37 | 37 | "status_id" => "c" %></td> |
|
38 | 38 | <td align="center"><%= link_to (aggregate data, { field_name => row.id }), |
|
39 | :controller => 'projects', :action => 'list_issues', :id => @project, | |
|
39 | :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)), | |
|
40 | 40 | :set_filter => 1, |
|
41 | 41 | "#{field_name}" => row.id, |
|
42 | 42 | "status_id" => "*" %></td> |
@@ -11,21 +11,21 | |||
|
11 | 11 | <tbody> |
|
12 | 12 | <% for row in rows %> |
|
13 | 13 | <tr class="<%= cycle("odd", "even") %>"> |
|
14 | <td><%= link_to row.name, :controller => 'projects', :action => 'list_issues', :id => @project, | |
|
14 | <td><%= link_to row.name, :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)), | |
|
15 | 15 | :set_filter => 1, |
|
16 | 16 | "#{field_name}" => row.id %></td> |
|
17 | 17 | <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 0 }), |
|
18 | :controller => 'projects', :action => 'list_issues', :id => @project, | |
|
18 | :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)), | |
|
19 | 19 | :set_filter => 1, |
|
20 | 20 | "#{field_name}" => row.id, |
|
21 | 21 | "status_id" => "o" %></td> |
|
22 | 22 | <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }), |
|
23 | :controller => 'projects', :action => 'list_issues', :id => @project, | |
|
23 | :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)), | |
|
24 | 24 | :set_filter => 1, |
|
25 | 25 | "#{field_name}" => row.id, |
|
26 | 26 | "status_id" => "c" %></td> |
|
27 | 27 | <td align="center"><%= link_to (aggregate data, { field_name => row.id }), |
|
28 | :controller => 'projects', :action => 'list_issues', :id => @project, | |
|
28 | :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)), | |
|
29 | 29 | :set_filter => 1, |
|
30 | 30 | "#{field_name}" => row.id, |
|
31 | 31 | "status_id" => "*" %></td> |
@@ -36,6 +36,11 | |||
|
36 | 36 | <h3><%=l(:field_priority)%> <%= link_to image_tag('zoom_in.png'), :detail => 'priority' %></h3> |
|
37 | 37 | <%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %> |
|
38 | 38 | <br /> |
|
39 | <% if @project.children.any? %> | |
|
40 | <h3><%=l(:field_subproject)%> <%= link_to image_tag('zoom_in.png'), :detail => 'subproject' %></h3> | |
|
41 | <%= render :partial => 'simple', :locals => { :data => @issues_by_subproject, :field_name => "project_id", :rows => @subprojects } %> | |
|
42 | <br /> | |
|
43 | <% end %> | |
|
39 | 44 | <h3><%=l(:field_category)%> <%= link_to image_tag('zoom_in.png'), :detail => 'category' %></h3> |
|
40 | 45 | <%= render :partial => 'simple', :locals => { :data => @issues_by_category, :field_name => "category_id", :rows => @categories } %> |
|
41 | 46 | <br /> |
General Comments 0
You need to be logged in to leave comments.
Login now