summaryrefslogtreecommitdiffstats
path: root/buglist.cgi
diff options
context:
space:
mode:
authorbugreport%peshkin.net <>2002-10-13 13:26:02 +0200
committerbugreport%peshkin.net <>2002-10-13 13:26:02 +0200
commitfd742d6fc8849328749866dbff2936d43abcc7d1 (patch)
tree1e4d7646a4589bcf44adceb452b38924286f7af1 /buglist.cgi
parentf61593bee73b37fc12caabbb2958b6515d688420 (diff)
downloadbugzilla-fd742d6fc8849328749866dbff2936d43abcc7d1.tar.gz
bugzilla-fd742d6fc8849328749866dbff2936d43abcc7d1.tar.xz
Bug 24789 [E|A|R] Add Estimated, Actual, Remaining Time Fields
patch by jeff.hedlund@matrixsi.com 2xr=joel,justdave
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-xbuglist.cgi33
1 files changed, 31 insertions, 2 deletions
diff --git a/buglist.cgi b/buglist.cgi
index 9f00e15ae..e71db0618 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -382,8 +382,10 @@ DefineColumn("os" , "bugs.op_sys" , "OS"
DefineColumn("target_milestone" , "bugs.target_milestone" , "Target Milestone" );
DefineColumn("votes" , "bugs.votes" , "Votes" );
DefineColumn("keywords" , "bugs.keywords" , "Keywords" );
-
-
+DefineColumn("estimated_time" , "bugs.estimated_time" , "Estimated Hours" );
+DefineColumn("remaining_time" , "bugs.remaining_time" , "Remaining Hours" );
+DefineColumn("actual_time" , "(SUM(ldtime.work_time)*COUNT(DISTINCT ldtime.bug_when)/COUNT(bugs.bug_id)) AS actual_time", "Actual Hours");
+DefineColumn("percentage_complete","(100*((SUM(ldtime.work_time)*COUNT(DISTINCT ldtime.bug_when)/COUNT(bugs.bug_id))/((SUM(ldtime.work_time)*COUNT(DISTINCT ldtime.bug_when)/COUNT(bugs.bug_id))+bugs.remaining_time))) AS percentage_complete", "% Complete");
################################################################################
# Display Column Determination
################################################################################
@@ -430,6 +432,14 @@ if (trim($::FORM{'votes'}) && !grep($_ eq 'votes', @displaycolumns)) {
push(@displaycolumns, 'votes');
}
+# Remove the timetracking columns if they are not a part of the group
+# (happens if a user had access to time tracking and it was revoked/disabled)
+if (!UserInGroup(Param("timetrackinggroup"))) {
+ @displaycolumns = grep($_ ne 'estimated_time', @displaycolumns);
+ @displaycolumns = grep($_ ne 'remaining_time', @displaycolumns);
+ @displaycolumns = grep($_ ne 'actual_time', @displaycolumns);
+ @displaycolumns = grep($_ ne 'percentage_complete', @displaycolumns);
+}
################################################################################
# Select Column Determination
@@ -440,6 +450,12 @@ if (trim($::FORM{'votes'}) && !grep($_ eq 'votes', @displaycolumns)) {
# The bug ID is always selected because bug IDs are always displayed
my @selectcolumns = ("id");
+# remaining and actual_time are required for precentage_complete calculation:
+if (lsearch(\@displaycolumns, "percentage_complete")) {
+ push (@selectcolumns, "remaining_time");
+ push (@selectcolumns, "actual_time");
+}
+
# Display columns are selected because otherwise we could not display them.
push (@selectcolumns, @displaycolumns);
@@ -459,6 +475,10 @@ if ($dotweak) {
# Convert the list of columns being selected into a list of column names.
my @selectnames = map($columns->{$_}->{'name'}, @selectcolumns);
+# Remove columns with no names, such as percentage_complete
+# (or a removed *_time column due to permissions)
+@selectnames = grep($_ ne '', @selectnames);
+
# Generate the basic SQL query that will be used to generate the bug list.
my $search = new Bugzilla::Search('fields' => \@selectnames,
'url' => $::buffer);
@@ -538,6 +558,15 @@ if ($order) {
# sort order was given
$db_order =~ s/bugs.votes\s*(,|$)/bugs.votes desc$1/i;
+ # the 'actual_time' field is defined as an aggregate function, but
+ # for order we just need the column name 'actual_time'
+ my $aggregate_search = quotemeta($columns->{'actual_time'}->{'name'});
+ $db_order =~ s/$aggregate_search/actual_time/g;
+
+ # the 'percentage_complete' field is defined as an aggregate too
+ $aggregate_search = quotemeta($columns->{'percentage_complete'}->{'name'});
+ $db_order =~ s/$aggregate_search/percentage_complete/g;
+
$query .= " ORDER BY $db_order ";
}