issues reports improvements

git-svn-id: http://redmine.rubyforge.org/svn/trunk@34 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2006-10-21 12:57:19 +00:00
parent 6a0022d7a1
commit 7473be4072
11 changed files with 135 additions and 36 deletions

View File

@ -21,9 +21,46 @@ class ReportsController < ApplicationController
def issue_report
@statuses = IssueStatus.find_all
@trackers = Tracker.find_all
@issues_by_tracker =
ActiveRecord::Base.connection.select_all("select s.id as status_id,
case params[:detail]
when "tracker"
@field = "tracker_id"
@rows = Tracker.find_all
@data = issues_by_tracker
@report_title = l(:field_tracker)
render :template => "reports/issue_report_details"
when "priority"
@field = "priority_id"
@rows = Enumeration::get_values('IPRI')
@data = issues_by_priority
@report_title = l(:field_priority)
render :template => "reports/issue_report_details"
when "category"
@field = "category_id"
@rows = @project.issue_categories
@data = issues_by_category
@report_title = l(:field_category)
render :template => "reports/issue_report_details"
else
@trackers = Tracker.find(:all)
@priorities = Enumeration::get_values('IPRI')
@categories = @project.issue_categories
issues_by_tracker
issues_by_priority
issues_by_category
render :template => "reports/issue_report"
end
end
private
# Find project of id params[:id]
def find_project
@project = Project.find(params[:id])
end
def issues_by_tracker
@issues_by_tracker ||=
ActiveRecord::Base.connection.select_all("select s.id as status_id,
s.is_closed as closed,
t.id as tracker_id,
count(i.id) as total
@ -33,9 +70,11 @@ class ReportsController < ApplicationController
i.status_id=s.id
and i.tracker_id=t.id
and i.project_id=#{@project.id}
group by s.id, s.is_closed, t.id")
@priorities = Enumeration::get_values('IPRI')
@issues_by_priority =
group by s.id, s.is_closed, t.id")
end
def issues_by_priority
@issues_by_priority ||=
ActiveRecord::Base.connection.select_all("select s.id as status_id,
s.is_closed as closed,
p.id as priority_id,
@ -46,9 +85,11 @@ class ReportsController < ApplicationController
i.status_id=s.id
and i.priority_id=p.id
and i.project_id=#{@project.id}
group by s.id, s.is_closed, p.id")
@categories = @project.issue_categories
@issues_by_category =
group by s.id, s.is_closed, p.id")
end
def issues_by_category
@issues_by_category ||=
ActiveRecord::Base.connection.select_all("select s.id as status_id,
s.is_closed as closed,
c.id as category_id,
@ -59,13 +100,6 @@ class ReportsController < ApplicationController
i.status_id=s.id
and i.category_id=c.id
and i.project_id=#{@project.id}
group by s.id, s.is_closed, c.id")
end
private
# Find project of id params[:id]
def find_project
@project = Project.find(params[:id])
group by s.id, s.is_closed, c.id")
end
end

View File

@ -0,0 +1,47 @@
<% if @statuses.empty? or rows.empty? %>
<p><i><%=l(:label_no_data)%></i></p>
<% else %>
<% col_width = 70 / (@statuses.length+3) %>
<table class="reportTableContent">
<tr>
<td width="25%"></td>
<% for status in @statuses %>
<td align="center" width="<%= col_width %>%" bgcolor="#<%= status.html_color %>"><small><%= status.name %></small></td>
<% end %>
<td align="center" width="<%= col_width %>%"><strong><%=l(:label_open_issues_plural)%></strong></td>
<td align="center" width="<%= col_width %>%"><strong><%=l(:label_closed_issues_plural)%></strong></td>
<td align="center" width="<%= col_width %>%"><strong><%=l(:label_total)%></strong></td>
</tr>
<% for row in rows %>
<tr class="<%= cycle("odd", "even") %>">
<td><%= link_to row.name, :controller => 'projects', :action => 'list_issues', :id => @project,
:set_filter => 1,
"#{field_name}" => row.id %></td>
<% for status in @statuses %>
<td align="center"><%= link_to (aggregate data, { field_name => row.id, "status_id" => status.id }),
:controller => 'projects', :action => 'list_issues', :id => @project,
:set_filter => 1,
"status_id" => status.id,
"#{field_name}" => row.id %></td>
<% end %>
<td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 0 }),
:controller => 'projects', :action => 'list_issues', :id => @project,
:set_filter => 1,
"#{field_name}" => row.id,
"status_id" => "O" %></td>
<td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }),
:controller => 'projects', :action => 'list_issues', :id => @project,
:set_filter => 1,
"#{field_name}" => row.id,
"status_id" => "C" %></td>
<td align="center"><%= link_to (aggregate data, { field_name => row.id }),
:controller => 'projects', :action => 'list_issues', :id => @project,
:set_filter => 1,
"#{field_name}" => row.id,
"status_id" => "A" %></td>
<% end %>
</tr>
</table>
<% end
reset_cycle %>

View File

@ -1,16 +1,12 @@
<% if @statuses.empty? or rows.empty? %>
<p><i><%=l(:label_no_data)%></i></p>
<% else %>
<% col_width = 70 / (@statuses.length+3) %>
<table border="0" cellspacing="1" cellpadding="2" width="100%">
<table class="reportTableContent">
<tr>
<td width="25%"></td>
<% for status in @statuses %>
<td align="center" width="<%= col_width %>%" bgcolor="#<%= status.html_color %>"><small><%= status.name %></small></td>
<% end %>
<td align="center" width="<%= col_width %>%"><strong><%=l(:label_open_issues_plural)%></strong></td>
<td align="center" width="<%= col_width %>%"><strong><%=l(:label_closed_issues_plural)%></strong></td>
<td align="center" width="<%= col_width %>%"><strong><%=l(:label_total)%></strong></td>
<td align="center" width="25%"><%=l(:label_open_issues_plural)%></td>
<td align="center" width="25%"><%=l(:label_closed_issues_plural)%></td>
<td align="center" width="25%"><%=l(:label_total)%></td>
</tr>
<% for row in rows %>
@ -18,13 +14,6 @@
<td><%= link_to row.name, :controller => 'projects', :action => 'list_issues', :id => @project,
:set_filter => 1,
"#{field_name}" => row.id %></td>
<% for status in @statuses %>
<td align="center"><%= link_to (aggregate data, { field_name => row.id, "status_id" => status.id }),
:controller => 'projects', :action => 'list_issues', :id => @project,
:set_filter => 1,
"status_id" => status.id,
"#{field_name}" => row.id %></td>
<% end %>
<td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 0 }),
:controller => 'projects', :action => 'list_issues', :id => @project,
:set_filter => 1,

View File

@ -1,14 +1,18 @@
<h2><%=l(:label_report_plural)%></h2>
<strong><%=l(:field_tracker)%></strong>
<div class="splitcontentleft">
<strong><%=l(:field_tracker)%></strong>
<%= render :partial => 'simple', :locals => { :data => @issues_by_tracker, :field_name => "tracker_id", :rows => @trackers } %>
<br />
<p align="right"><small><%= link_to l(:label_details), :detail => 'tracker' %></small>&nbsp;</p>
<strong><%=l(:field_priority)%></strong>
<%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>
<br />
<p align="right"><small><%= link_to l(:label_details), :detail => 'priority' %></small>&nbsp;</p>
</div>
<div class="splitcontentright">
<strong><%=l(:field_category)%></strong>
<%= render :partial => 'simple', :locals => { :data => @issues_by_category, :field_name => "category_id", :rows => @categories } %>
<p align="right"><small><%= link_to l(:label_details), :detail => 'category' %></small>&nbsp;</p>
</div>
&nbsp;

View File

@ -0,0 +1,7 @@
<h2><%=l(:label_report_plural)%></h2>
<strong><%=@report_title%></strong>
<%= render :partial => 'details', :locals => { :data => @data, :field_name => @field, :rows => @rows } %>
<br />
<%= link_to l(:button_back), :action => 'issue_report' %>

View File

@ -240,6 +240,7 @@ label_none: Kein
label_next: Weiter
label_previous: Zurück
label_used_by: Benutzt von
#label_details: Details...
button_login: Einloggen
button_submit: Einreichen
@ -260,6 +261,7 @@ button_download: Fernzuladen
button_list: Aufzulisten
button_view: Siehe
button_move: Bewegen
#button_back: Back
text_select_mail_notifications: Aktionen für die Mailbenachrichtigung aktiviert werden soll.
text_regexp_info: eg. ^[A-Z0-9]+$

View File

@ -240,6 +240,7 @@ label_none: None
label_next: Next
label_previous: Previous
label_used_by: Used by
label_details: Details...
button_login: Login
button_submit: Submit
@ -260,6 +261,7 @@ button_download: Download
button_list: List
button_view: View
button_move: Move
button_back: Back
text_select_mail_notifications: Select actions for which mail notifications should be sent.
text_regexp_info: eg. ^[A-Z0-9]+$

View File

@ -240,6 +240,7 @@ label_none: Ninguno
label_next: Próximo
label_previous: Precedente
label_used_by: Utilizado por
#label_details: Details...
button_login: Conexión
button_submit: Someter
@ -260,6 +261,7 @@ button_download: Telecargar
button_list: Listar
button_view: Ver
button_move: Mover
#button_back: Back
text_select_mail_notifications: Seleccionar las actividades que necesitan la activación de la notificación por mail.
text_regexp_info: eg. ^[A-Z0-9]+$

View File

@ -240,6 +240,7 @@ label_none: Aucun
label_next: Suivant
label_previous: Précédent
label_used_by: Utilisé par
label_details: Détails...
button_login: Connexion
button_submit: Soumettre
@ -260,6 +261,7 @@ button_download: Télécharger
button_list: Lister
button_view: Voir
button_move: Déplacer
button_back: Retour
text_select_mail_notifications: Sélectionner les actions pour lesquelles la notification par mail doit être activée.
text_regexp_info: ex. ^[A-Z0-9]+$

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

View File

@ -265,6 +265,16 @@ tr.even {
background-color: #fff;
}
table.reportTableContent {
border:1px solid #c0c0c0;
width:99%;
border-collapse: collapse;
}
table.reportTableContent td {
padding:2px;
}
hr { border:none; border-bottom: dotted 2px #c0c0c0; }