From 6ba10a1b6b1f5cc87ec8c885f6e61a0a77166abf Mon Sep 17 00:00:00 2001 From: "gerv%gerv.net" <> Date: Sat, 10 Mar 2001 09:47:30 +0000 Subject: Whitespace changes only; removing tabs and reformatting my changes to match the rest of the file. Long overdue. --- collectstats.pl | 117 +++++++++++++++++++++++++++----------------------------- 1 file changed, 56 insertions(+), 61 deletions(-) (limited to 'collectstats.pl') diff --git a/collectstats.pl b/collectstats.pl index 66bbbfc19..e645165e1 100755 --- a/collectstats.pl +++ b/collectstats.pl @@ -20,7 +20,7 @@ # # Contributor(s): Terry Weissman , # Harrison Page -# Gervase Markham +# Gervase Markham # Run me out of cron at midnight to collect Bugzilla statistics. @@ -33,11 +33,11 @@ require "globals.pl"; # tidy up after graphing module if (chdir("graphs")) { - unlink <./*.gif>; + unlink <./*.gif>; unlink <./*.png>; chdir(".."); } - + ConnectToDatabase(1); GetVersionTable(); @@ -77,36 +77,38 @@ sub collect_stats { if (open DATA, ">>$file") { push my @row, &today; - foreach my $status ('NEW', 'ASSIGNED', 'REOPENED', 'UNCONFIRMED', 'RESOLVED', 'VERIFIED', 'CLOSED') { - if( $product eq "-All-" ) { - SendSQL("select count(bug_status) from bugs where bug_status='$status'"); - } else { - SendSQL("select count(bug_status) from bugs where bug_status='$status' and product='$product'"); - } - - push @row, FetchOneColumn(); - } - - foreach my $resolution ('FIXED', 'INVALID', 'WONTFIX', 'LATER', 'REMIND', 'DUPLICATE', 'WORKSFORME', 'MOVED') { - if( $product eq "-All-" ) { - SendSQL("select count(resolution) from bugs where resolution='$resolution'"); - } else { - SendSQL("select count(resolution) from bugs where resolution='$resolution' and product='$product'"); - } - push @row, FetchOneColumn(); - } - - if (! $exists) { - print DATA < 0) - { - # add that count onto the bug it is a dupe of, - # and zero the count; the check is to avoid - # loops - if ($count{$dupes{$key}} != 0) - { - $count{$dupes{$key}} += $count{$key}; - $count{$key} = 0; - $changed = 1; - } - } - } + $changed = 0; + foreach $key (keys(%count)) { + # if this bug is actually itself a dupe, and has a count... + if (defined($dupes{$key}) && $count{$key} > 0) { + # add that count onto the bug it is a dupe of, + # and zero the count; the check is to avoid + # loops + if ($count{$dupes{$key}} != 0) { + $count{$dupes{$key}} += $count{$key}; + $count{$key} = 0; + $changed = 1; + } + } + } } # Remove the values for which the count is zero foreach $key (keys(%count)) { - if ($count{$key} == 0) - { - delete $count{$key}; - } + if ($count{$key} == 0) { + delete $count{$key}; + } } dbmclose(%count); -- cgit v1.2.3-24-g4f1b