summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgerv%gerv.net <>2005-04-12 07:39:11 +0200
committergerv%gerv.net <>2005-04-12 07:39:11 +0200
commit9782d3fe78d30a89ff6439e0a311d88d5ed190c5 (patch)
treed196c786d8efe3d2b9990b83f24d5018c9b6b1c7
parent4d1306f6d512c09be883c13d2aef6b4dda84e855 (diff)
downloadbugzilla-9782d3fe78d30a89ff6439e0a311d88d5ed190c5.tar.gz
bugzilla-9782d3fe78d30a89ff6439e0a311d88d5ed190c5.tar.xz
Bug 278268 - make Grand Total line not appear if data set add fails. Patch by colin.ogilvie; r=gerv, a=justdave.
-rw-r--r--Bugzilla/Chart.pm25
1 files changed, 15 insertions, 10 deletions
diff --git a/Bugzilla/Chart.pm b/Bugzilla/Chart.pm
index beb5a9b9d..0cc41f9a4 100644
--- a/Bugzilla/Chart.pm
+++ b/Bugzilla/Chart.pm
@@ -115,16 +115,11 @@ sub add {
my $self = shift;
my @series_ids = @_;
- # If we are going from < 2 to >= 2 series, add the Grand Total line.
- if (!$self->{'gt'}) {
- my $current_size = scalar($self->getSeriesIDs());
- if ($current_size < 2 &&
- $current_size + scalar(@series_ids) >= 2)
- {
- $self->{'gt'} = 1;
- }
- }
-
+ # Get the current size of the series; required for adding Grand Total later
+ my $current_size = scalar($self->getSeriesIDs());
+
+ # Count the number of added series
+ my $added = 0;
# Create new Series and push them on to the list of lines.
# Note that new lines have no label; the display template is responsible
# for inventing something sensible.
@@ -133,6 +128,16 @@ sub add {
if ($series) {
push(@{$self->{'lines'}}, [$series]);
push(@{$self->{'labels'}}, "");
+ $added++;
+ }
+ }
+
+ # If we are going from < 2 to >= 2 series, add the Grand Total line.
+ if (!$self->{'gt'}) {
+ if ($current_size < 2 &&
+ $current_size + $added >= 2)
+ {
+ $self->{'gt'} = 1;
}
}
}