summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2009-01-04 18:44:35 +0100
committerlpsolit%gmail.com <>2009-01-04 18:44:35 +0100
commit26428bd5366a710abf864745ce2706e482b86aa9 (patch)
treeb9abb336efb3bd525f6deec5dda3c7c8843793a9
parent8ecc07050fd3d7d9b6bd136511ee4c8098f7c500 (diff)
downloadbugzilla-26428bd5366a710abf864745ce2706e482b86aa9.tar.gz
bugzilla-26428bd5366a710abf864745ce2706e482b86aa9.tar.xz
Bug 316425: Summarize time estimates on buglist page - Patch by Aaron Larson <aaron@larsonsonline.net> r=wicked a=LpSolit
-rwxr-xr-xbuglist.cgi31
-rw-r--r--skins/standard/buglist.css17
-rw-r--r--template/en/default/list/table.html.tmpl33
3 files changed, 81 insertions, 0 deletions
diff --git a/buglist.cgi b/buglist.cgi
index 037edae70..32fb1b3f0 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -1065,6 +1065,22 @@ $buglist_sth->execute();
# Retrieve the query results one row at a time and write the data into a list
# of Perl records.
+# If we're doing time tracking, then keep totals for all bugs.
+my $percentage_complete = lsearch(\@displaycolumns, 'percentage_complete') >= 0;
+my $estimated_time = lsearch(\@displaycolumns, 'estimated_time') >= 0;
+my $remaining_time = ((lsearch(\@displaycolumns, 'remaining_time') >= 0)
+ || $percentage_complete);
+my $actual_time = ((lsearch(\@displaycolumns, 'actual_time') >= 0)
+ || $percentage_complete);
+
+my $time_info = { 'estimated_time' => 0,
+ 'remaining_time' => 0,
+ 'actual_time' => 0,
+ 'percentage_complete' => 0,
+ 'time_present' => ($estimated_time || $remaining_time ||
+ $actual_time || $percentage_complete),
+ };
+
my $bugowners = {};
my $bugproducts = {};
my $bugstatuses = {};
@@ -1108,6 +1124,11 @@ while (my @row = $buglist_sth->fetchrow_array()) {
# Add id to list for checking for bug privacy later
push(@bugidlist, $bug->{'bug_id'});
+
+ # Compute time tracking info.
+ $time_info->{'estimated_time'} += $bug->{'estimated_time'} if ($estimated_time);
+ $time_info->{'remaining_time'} += $bug->{'remaining_time'} if ($remaining_time);
+ $time_info->{'actual_time'} += $bug->{'actual_time'} if ($actual_time);
}
# Check for bug privacy and set $bug->{'secure_mode'} to 'implied' or 'manual'
@@ -1140,6 +1161,15 @@ if (@bugidlist) {
}
}
+# Compute percentage complete without rounding.
+my $sum = $time_info->{'actual_time'}+$time_info->{'remaining_time'};
+if ($sum > 0) {
+ $time_info->{'percentage_complete'} = 100*$time_info->{'actual_time'}/$sum;
+}
+else { # remaining_time <= 0
+ $time_info->{'percentage_complete'} = 0
+}
+
################################################################################
# Template Variable Definition
################################################################################
@@ -1165,6 +1195,7 @@ $vars->{'urlquerypart'} = $params->canonicalise_query('order',
'query_based_on');
$vars->{'order'} = $order;
$vars->{'caneditbugs'} = 1;
+$vars->{'time_info'} = $time_info;
if (!Bugzilla->user->in_group('editbugs')) {
foreach my $product (keys %$bugproducts) {
diff --git a/skins/standard/buglist.css b/skins/standard/buglist.css
index fa50bcb2d..fb4801d79 100644
--- a/skins/standard/buglist.css
+++ b/skins/standard/buglist.css
@@ -71,6 +71,23 @@ tr.bz_secure_mode_implied td.first-child {
tr.bz_secure_mode_manual td.first-child {
}
+td.bz_estimated_time_column,
+td.bz_remaining_time_column,
+td.bz_actual_time_column,
+td.bz_percentage_complete_column {
+ text-align: right;
+}
+
+tr.bz_time_summary_line {
+ background: black;
+ color: white;
+}
+
+td.bz_total_label {
+ font-weight: bold;
+ text-align: right;
+}
+
#commit, #action {
margin-top: .25em;
}
diff --git a/template/en/default/list/table.html.tmpl b/template/en/default/list/table.html.tmpl
index 667d077f8..9b27b0094 100644
--- a/template/en/default/list/table.html.tmpl
+++ b/template/en/default/list/table.html.tmpl
@@ -223,7 +223,40 @@
# end the current table.
#%]
[% IF loop.last() || loop.count() % 100 == 0 %]
+ [% IF loop.last() && time_info.time_present == 1 %]
+ [% PROCESS time_summary_line %]
+ [% END %]
</table>
[% END %]
[% END %]
+
+
+[% BLOCK time_summary_line %]
+ <tr class="bz_time_summary_line">
+ [% columns_to_span = 1 %] [%# bugID %]
+ [% IF dotweak %]
+ [% columns_to_span = columns_to_span + 1 %]
+ [% END %]
+ [% FOREACH column = displaycolumns %]
+ [% IF column == 'actual_time' ||
+ column == 'remaining_time' ||
+ column == 'estimated_time' ||
+ column == 'percentage_complete' %]
+ [% IF columns_to_span > 0 %]
+ <td class="bz_total_label" colspan="[% columns_to_span FILTER html %]"><b>Totals</b></td>
+ [% columns_to_span = 0 %]
+ [% END %]
+ [% IF column == 'percentage_complete' %]
+ <td>[% time_info.percentage_complete FILTER format(abbrev.$column.format_value) FILTER html -%]</td>
+ [% ELSE %]
+ <td>[% PROCESS formattimeunit time_unit=time_info.$column %]</td>
+ [% END %]
+ [% ELSIF columns_to_span == 0 %] [%# A column following the first total %]
+ <td>&nbsp;</td>
+ [% ELSE %] [%# We haven't gotten to a time column yet, keep computing span %]
+ [% columns_to_span = columns_to_span + 1 %]
+ [% END %]
+ [% END %]
+ </tr>
+[% END %]