summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgerv%gerv.net <>2004-01-27 08:23:08 +0100
committergerv%gerv.net <>2004-01-27 08:23:08 +0100
commit8dc09cd56b82c84f93471fdb97a3c7f64e886143 (patch)
treeae56581e2bc20c167aecd0e5ff0e72cf81990dc8
parentc91ea0fefd6fc35e1c829cd93137ecc3d6e610aa (diff)
downloadbugzilla-8dc09cd56b82c84f93471fdb97a3c7f64e886143.tar.gz
bugzilla-8dc09cd56b82c84f93471fdb97a3c7f64e886143.tar.xz
Bug 225043 - enhance chart migration code to populate 'All Open' charts from historical data. Patch by gerv; r,a=justdave.
-rwxr-xr-xchecksetup.pl16
1 files changed, 15 insertions, 1 deletions
diff --git a/checksetup.pl b/checksetup.pl
index 255fc56e0..a8a73ce43 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -3758,6 +3758,7 @@ if (!$series_exists) {
$open_name, $::userid, 1,
$query_prod . $query, 1);
$series->writeToDatabase();
+ $seriesids{$open_name} = $series->{'series_id'};
# Now, we attempt to read in historical data, if any
# Convert the name in the same way that collectstats.pl does
@@ -3772,20 +3773,33 @@ if (!$series_exists) {
# The data files should be in a standard format, even for old
# Bugzillas, because of the conversion code further up this file.
my %data;
+ my $last_date = "";
while (<IN>) {
if (/^(\d+\|.*)/) {
my @numbers = split(/\||\r/, $1);
+
+ # Only take the first line for each date; it was possible to
+ # run collectstats.pl more than once in a day.
+ next if $numbers[0] eq $last_date;
+
for my $i (0 .. $#fields) {
# $numbers[0] is the date
$data{$fields[$i]}{$numbers[0]} = $numbers[$i + 1];
+
+ # Keep a total of the number of open bugs for this day
+ if (IsOpenedState($fields[$i])) {
+ $data{$open_name}{$numbers[0]} += $numbers[$i + 1];
+ }
}
+
+ $last_date = $numbers[0];
}
}
close(IN);
- foreach my $field (@fields) {
+ foreach my $field (@fields, $open_name) {
# Insert values into series_data: series_id, date, value
my %fielddata = %{$data{$field}};
foreach my $date (keys %fielddata) {