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

[email protected]
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
Author: spadkins
Date: Fri Aug 31 10:08:27 2007
New Revision: 9900

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

Log:
0000345: Hotel Occ% Totals was zero (summarize_rows). Plus fixed null column in extend_columns

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	Fri Aug 31 10:08:27 2007
@@ -919,7 +919,7 @@
     &App::sub_entry if ($App::trace);
     my ($self, $table, $cols, $options) = @_;
     my (%colidx, $expr_columns, $expr, $extended, $col);
-    my $OPTIONAL_DEFAULT = '(?::([-0-9\.]+))?';
+    my $OPTIONAL_DEFAULT = '(?::[-0-9\.]+)?';
     # Take note of which columns are alread in the list of requested columns.
     for (my $i = 0; $i <= $#$cols; $i++) {
         $col = $cols->[$i];
@@ -2962,6 +2962,11 @@
     &App::sub_entry if ($App::trace);
     my ($self, $table, $rows, $columns, $summary_keys, $options) = @_;
 
+    #print STDERR "summarize_rows($table, ..., ..., [@$summary_keys], ...)\n";
+    #foreach my $row (@$rows) {
+    #    print STDERR "summarize_rows(IN)  {", join("|", %$row), "}\n";
+    #}
+
     $summary_keys = [] if (!$summary_keys);
 
     my $table_def = $self->get_table_def($table);
@@ -3069,6 +3074,14 @@
             elsif ($column_defs->{$column}{is_key}) {
                 # do nothing
             }
+            elsif ($column_defs->{$column}{type} && $column_defs->{$column}{type} =~ /^(integer|float)$/) {
+                push(@$sum_column_idx, $i);
+                $alternate_aggregate->[$i] = $rel_aggregate{$rel_name};
+            }
+            elsif (defined $column_defs->{$column}{default} && $column_defs->{$column}{default} =~ /^-?[0-9\.]+$/) {
+                push(@$sum_column_idx, $i);
+                $alternate_aggregate->[$i] = $rel_aggregate{$rel_name};
+            }
             elsif (defined $value && $value =~ /^-?[0-9\.]+$/) {
                 push(@$sum_column_idx, $i);
                 $alternate_aggregate->[$i] = $rel_aggregate{$rel_name};
@@ -3239,6 +3252,10 @@
             }
         }
     }
+
+    #foreach my $row (@summary_rows) {
+    #    print STDERR "summarize_rows(OUT) {", join("|", %$row), "}\n";
+    #}
     
     &App::sub_exit(\@summary_rows) if ($App::trace);
     return(\@summary_rows);
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.