Commit 8918a55e authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 344969: Remove hardcoded bug statuses from collectstats.pl and reports.cgi…

Bug 344969: Remove hardcoded bug statuses from collectstats.pl and reports.cgi (prepare them for custom statuses) - Patch by Fré©ric Buclin <LpSolit@gmail.com> r=gerv a=LpSolit
parent 49ac4e07
...@@ -72,19 +72,21 @@ my $datadir = bz_locations()->{'datadir'}; ...@@ -72,19 +72,21 @@ my $datadir = bz_locations()->{'datadir'};
my @myproducts = map {$_->name} Bugzilla::Product->get_all; my @myproducts = map {$_->name} Bugzilla::Product->get_all;
unshift(@myproducts, "-All-"); unshift(@myproducts, "-All-");
# As we can now customize the list of resolutions, looking at the actual list # As we can now customize statuses and resolutions, looking at the current list
# of available resolutions only is not enough as some now removed resolutions # of legal values only is not enough as some now removed statuses and resolutions
# may have existed in the past, or have been renamed. We want them all. # may have existed in the past, or have been renamed. We want them all.
my @resolutions = @{get_legal_field_values('resolution')}; my $fields = {};
my $old_resolutions = foreach my $field ('bug_status', 'resolution') {
$dbh->selectcol_arrayref('SELECT bugs_activity.added my $values = get_legal_field_values($field);
my $old_values = $dbh->selectcol_arrayref(
"SELECT bugs_activity.added
FROM bugs_activity FROM bugs_activity
INNER JOIN fielddefs INNER JOIN fielddefs
ON fielddefs.id = bugs_activity.fieldid ON fielddefs.id = bugs_activity.fieldid
LEFT JOIN resolution LEFT JOIN $field
ON resolution.value = bugs_activity.added ON $field.value = bugs_activity.added
WHERE fielddefs.name = ? WHERE fielddefs.name = ?
AND resolution.id IS NULL AND $field.id IS NULL
UNION UNION
...@@ -92,19 +94,21 @@ my $old_resolutions = ...@@ -92,19 +94,21 @@ my $old_resolutions =
FROM bugs_activity FROM bugs_activity
INNER JOIN fielddefs INNER JOIN fielddefs
ON fielddefs.id = bugs_activity.fieldid ON fielddefs.id = bugs_activity.fieldid
LEFT JOIN resolution LEFT JOIN $field
ON resolution.value = bugs_activity.removed ON $field.value = bugs_activity.removed
WHERE fielddefs.name = ? WHERE fielddefs.name = ?
AND resolution.id IS NULL', AND $field.id IS NULL",
undef, ('resolution', 'resolution')); undef, ($field, $field));
push(@resolutions, @$old_resolutions); push(@$values, @$old_values);
$fields->{$field} = $values;
}
my @statuses = @{$fields->{'bug_status'}};
my @resolutions = @{$fields->{'resolution'}};
# Exclude "" from the resolution list. # Exclude "" from the resolution list.
@resolutions = grep {$_} @resolutions; @resolutions = grep {$_} @resolutions;
# Actually, the list of statuses is predefined. This will change in the near future.
my @statuses = qw(NEW ASSIGNED REOPENED UNCONFIRMED RESOLVED VERIFIED CLOSED);
my $tstart = time; my $tstart = time;
foreach (@myproducts) { foreach (@myproducts) {
my $dir = "$datadir/mining"; my $dir = "$datadir/mining";
......
...@@ -75,7 +75,7 @@ if (! defined $cgi->param('product')) { ...@@ -75,7 +75,7 @@ if (! defined $cgi->param('product')) {
|| ThrowCodeError('chart_dir_nonexistent', || ThrowCodeError('chart_dir_nonexistent',
{dir => $dir, graph_dir => $graph_dir}); {dir => $dir, graph_dir => $graph_dir});
my %default_sel = map { $_ => 1 } qw/UNCONFIRMED NEW ASSIGNED REOPENED/; my %default_sel = map { $_ => 1 } BUG_STATE_OPEN;
my @datasets; my @datasets;
my @data = get_data($dir); my @data = get_data($dir);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment