Project

General

Profile

Feature #19378 » issue_summary_add_summary_by_status.patch

Bahri Yardim, 2015-03-13 21:06

View differences:

app/controllers/reports_controller.rb (working copy)
27 27
    @assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort
28 28
    @authors = @project.users.sort
29 29
    @subprojects = @project.descendants.visible
30
    @statuses = IssueStatus.all
30 31

  
31 32
    @issues_by_tracker = Issue.by_tracker(@project)
32 33
    @issues_by_version = Issue.by_version(@project)
......
35 36
    @issues_by_assigned_to = Issue.by_assigned_to(@project)
36 37
    @issues_by_author = Issue.by_author(@project)
37 38
    @issues_by_subproject = Issue.by_subproject(@project) || []
39
    @issues_by_status = Issue.by_status(@project)
38 40

  
39 41
    render :template => "reports/issue_report"
40 42
  end
app/models/issue.rb (working copy)
1253 1253
    r.reject {|r| r["project_id"] == project.id.to_s}
1254 1254
  end
1255 1255

  
1256
  def self.by_status(project)
1257
    count_and_group_by(:project => project,
1258
                       :field => 'status_id',
1259
                       :joins => IssueStatus.table_name)
1260
  end
1261

  
1256 1262
  # Query generator for selecting groups of issue counts for a project
1257 1263
  # based on specific criteria
1258 1264
  #
app/views/reports/_simple_status.html.erb (working copy)
1
<% if @statuses.empty? or rows.empty? %>
2
    <p><i><%=l(:label_no_data)%></i></p>
3
<% else %>
4
    <table class="list issue-report">
5
      <thead><tr>
6
        <th></th>
7
        <th><%=l(:label_total)%></th>
8
      </tr></thead>
9
      <tbody>
10
      <% for row in rows %>
11
          <tr class="<%= cycle("odd", "even") %>">
12
            <td class="name"><%= link_to h(row.name), aggregate_path(@project, field_name, row) %></td>
13
            <td><%= aggregate_link data, { field_name => row.id }, aggregate_path(@project, field_name, row, :status_id => "*") %></td>
14
          </tr>
15
      <% end %>
16
      </tbody>
17
    </table>
18
<% end
19
   reset_cycle %>
app/views/reports/issue_report.html.erb (working copy)
17 17
</div>
18 18

  
19 19
<div class="splitcontentright">
20
<h3><%=l(:field_status)%></h3>
21
<%= render :partial => 'simple_status', :locals => { :data => @issues_by_status, :field_name => "status_id", :rows => @statuses } %>
22
<br />
20 23
<h3><%=l(:field_version)%>&nbsp;&nbsp;<%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'version') %></h3>
21 24
<%= render :partial => 'simple', :locals => { :data => @issues_by_version, :field_name => "fixed_version_id", :rows => @versions } %>
22 25
<br />
(2-2/2)