##// END OF EJS Templates
Added subprojects issue count on project "Reports" page...
Jean-Philippe Lang -
r407:52ced19e2e58
parent child
Show More
@@ -47,16 +47,24 class ReportsController < ApplicationController
47 @data = issues_by_author
47 @data = issues_by_author
48 @report_title = l(:field_author)
48 @report_title = l(:field_author)
49 render :template => "reports/issue_report_details"
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 else
56 else
51 @queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)]
57 @queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)]
52 @trackers = Tracker.find(:all, :order => 'position')
58 @trackers = Tracker.find(:all, :order => 'position')
53 @priorities = Enumeration::get_values('IPRI')
59 @priorities = Enumeration::get_values('IPRI')
54 @categories = @project.issue_categories
60 @categories = @project.issue_categories
55 @authors = @project.members.collect { |m| m.user }
61 @authors = @project.members.collect { |m| m.user }
62 @subprojects = @project.children
56 issues_by_tracker
63 issues_by_tracker
57 issues_by_priority
64 issues_by_priority
58 issues_by_category
65 issues_by_category
59 issues_by_author
66 issues_by_author
67 issues_by_subproject
60 @total_hours = @project.time_entries.sum(:hours)
68 @total_hours = @project.time_entries.sum(:hours)
61 render :template => "reports/issue_report"
69 render :template => "reports/issue_report"
62 end
70 end
@@ -165,4 +173,19 private
165 and i.project_id=#{@project.id}
173 and i.project_id=#{@project.id}
166 group by s.id, s.is_closed, a.id")
174 group by s.id, s.is_closed, a.id")
167 end
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 end
191 end
@@ -15,28 +15,28
15 <tbody>
15 <tbody>
16 <% for row in rows %>
16 <% for row in rows %>
17 <tr class="<%= cycle("odd", "even") %>">
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 :set_filter => 1,
19 :set_filter => 1,
20 "#{field_name}" => row.id %></td>
20 "#{field_name}" => row.id %></td>
21 <% for status in @statuses %>
21 <% for status in @statuses %>
22 <td align="center"><%= link_to (aggregate data, { field_name => row.id, "status_id" => status.id }),
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 :set_filter => 1,
24 :set_filter => 1,
25 "status_id" => status.id,
25 "status_id" => status.id,
26 "#{field_name}" => row.id %></td>
26 "#{field_name}" => row.id %></td>
27 <% end %>
27 <% end %>
28 <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 0 }),
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 :set_filter => 1,
30 :set_filter => 1,
31 "#{field_name}" => row.id,
31 "#{field_name}" => row.id,
32 "status_id" => "o" %></td>
32 "status_id" => "o" %></td>
33 <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }),
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 :set_filter => 1,
35 :set_filter => 1,
36 "#{field_name}" => row.id,
36 "#{field_name}" => row.id,
37 "status_id" => "c" %></td>
37 "status_id" => "c" %></td>
38 <td align="center"><%= link_to (aggregate data, { field_name => row.id }),
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 :set_filter => 1,
40 :set_filter => 1,
41 "#{field_name}" => row.id,
41 "#{field_name}" => row.id,
42 "status_id" => "*" %></td>
42 "status_id" => "*" %></td>
@@ -11,21 +11,21
11 <tbody>
11 <tbody>
12 <% for row in rows %>
12 <% for row in rows %>
13 <tr class="<%= cycle("odd", "even") %>">
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 :set_filter => 1,
15 :set_filter => 1,
16 "#{field_name}" => row.id %></td>
16 "#{field_name}" => row.id %></td>
17 <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 0 }),
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 :set_filter => 1,
19 :set_filter => 1,
20 "#{field_name}" => row.id,
20 "#{field_name}" => row.id,
21 "status_id" => "o" %></td>
21 "status_id" => "o" %></td>
22 <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }),
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 :set_filter => 1,
24 :set_filter => 1,
25 "#{field_name}" => row.id,
25 "#{field_name}" => row.id,
26 "status_id" => "c" %></td>
26 "status_id" => "c" %></td>
27 <td align="center"><%= link_to (aggregate data, { field_name => row.id }),
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 :set_filter => 1,
29 :set_filter => 1,
30 "#{field_name}" => row.id,
30 "#{field_name}" => row.id,
31 "status_id" => "*" %></td>
31 "status_id" => "*" %></td>
@@ -36,6 +36,11
36 <h3><%=l(:field_priority)%>&nbsp;&nbsp;<%= link_to image_tag('zoom_in.png'), :detail => 'priority' %></h3>
36 <h3><%=l(:field_priority)%>&nbsp;&nbsp;<%= link_to image_tag('zoom_in.png'), :detail => 'priority' %></h3>
37 <%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>
37 <%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>
38 <br />
38 <br />
39 <% if @project.children.any? %>
40 <h3><%=l(:field_subproject)%>&nbsp;&nbsp;<%= 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 <h3><%=l(:field_category)%>&nbsp;&nbsp;<%= link_to image_tag('zoom_in.png'), :detail => 'category' %></h3>
44 <h3><%=l(:field_category)%>&nbsp;&nbsp;<%= link_to image_tag('zoom_in.png'), :detail => 'category' %></h3>
40 <%= render :partial => 'simple', :locals => { :data => @issues_by_category, :field_name => "category_id", :rows => @categories } %>
45 <%= render :partial => 'simple', :locals => { :data => @issues_by_category, :field_name => "category_id", :rows => @categories } %>
41 <br />
46 <br />
General Comments 0
You need to be logged in to leave comments. Login now