[Rt-commit] r14884 - rt/branches/3.6-EXPERIMENTAL-PAGING/lib/RT

ruz at bestpractical.com ruz at bestpractical.com
Wed Aug 6 20:43:52 EDT 2008


Author: ruz
Date: Wed Aug  6 20:43:50 2008
New Revision: 14884

Modified:
   rt/branches/3.6-EXPERIMENTAL-PAGING/lib/RT/Tickets_Overlay.pm

Log:
* fix problem with trailing incomplete page

Modified: rt/branches/3.6-EXPERIMENTAL-PAGING/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/3.6-EXPERIMENTAL-PAGING/lib/RT/Tickets_Overlay.pm	(original)
+++ rt/branches/3.6-EXPERIMENTAL-PAGING/lib/RT/Tickets_Overlay.pm	Wed Aug  6 20:43:50 2008
@@ -2867,14 +2867,14 @@
         my $records = $self->_Handle->SimpleQuery($QueryString);
         last unless $records;
 
-        my $seen_at_least_one = 0;
+        my ($found_total, $found_filtered) = (0, 0);
         while ( my $row = $records->fetchrow_hashref ) {
-            $seen_at_least_one = 1; $current_page_size++; $offset++;
+            $found_total++; $current_page_size++; $offset++;
             my $item = $self->NewItem;
             $item->LoadFromHash( $row );
             next if $self->FilterRecord( $item );
 
-            $must_find_rows--;
+            $found_filtered++;
             push @res, $item if $current_page == $page;
 
             unless ( --$current_page_left ) {
@@ -2889,12 +2889,16 @@
         }
         $RT::Logger->error("SQL error: ". $records->err) if $records->err;
 
-        unless ( $seen_at_least_one ) {
+        unless ( $found_total ) {
             for ($current_page .. $page) {
                 $map->[$_] = [$offset, 0];
             }
             last;
+        } elsif ( $found_total < $must_find_rows ) {
+            $map->[$current_page+1] = [$offset, 0];
+            last;
         }
+        $must_find_rows -= $found_filtered;
     }
     $self->{'must_redo_search'} = 0;
     $self->{'items'} = \@res;


More information about the Rt-commit mailing list