[svn:p5ee] r9714 - p5ee/trunk/App-Repository/lib/App

[email protected]
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
Author: spadkins
Date: Tue Jul 10 14:24:26 2007
New Revision: 9714

Modified:
   p5ee/trunk/App-Repository/lib/App/Repository.pm

Log:
summarize_rows() produces a undef if all values that are summed are undef

Modified: p5ee/trunk/App-Repository/lib/App/Repository.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/Repository.pm	(original)
+++ p5ee/trunk/App-Repository/lib/App/Repository.pm	Tue Jul 10 14:24:26 2007
@@ -3074,7 +3074,7 @@
                     }
                 }
                 foreach $i (@$sum_column_idx) {
-                    $summary_row->[$i] = 0;
+                    $summary_row->[$i] = undef;
                 }
                 $summary_row{$key} = $summary_row;
                 push(@summary_key_values, $key);
@@ -3089,11 +3089,25 @@
                             $alternate_aggregate_row_idx->{$alternate_aggregate_key} = $rowidx;
                         }
                         if ($alternate_aggregate_row_idx->{$alternate_aggregate_key} == $rowidx) {
-                            $summary_row->[$i] += $row->[$i];
+                            if (defined $row->[$i]) {
+                                if (defined $summary_row->[$i]) {
+                                    $summary_row->[$i] += $row->[$i];
+                                }
+                                else {
+                                    $summary_row->[$i] = $row->[$i];
+                                }
+                            }
                         }
                     }
                     else {
-                        $summary_row->[$i] += $row->[$i];
+                        if (defined $row->[$i]) {
+                            if (defined $summary_row->[$i]) {
+                                $summary_row->[$i] += $row->[$i];
+                            }
+                            else {
+                                $summary_row->[$i] = $row->[$i];
+                            }
+                        }
                     }
                 }
             }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.