From Redis to Postgres - Part 3 (Bugfixes, first try)
[gruntmaster-page.git] / lib / Gruntmaster / Page / Generic.pm
index 256add635bed2a31ed85d929cab7e710722ea57f..10ed5568e6831b88ea43d0da93b27956dab7016c 100644 (file)
@@ -37,6 +37,7 @@ sub list {
        $rs = $rs->search(undef, {order_by => 'me.id'}) unless $rs->is_ordered;
        if (my $page = $env->{'gruntmaster.page'}) {
                my $pages = $rs->count / PAGE_SIZE;
+               $page = $pages if $page == -1;
                $rs = $rs->search(undef, {offset => ($page - 1) * PAGE_SIZE, ($page == $pages ? () : (rows => PAGE_SIZE))});
        }
        $rs = $rs->search(undef, {prefetch => $thing{prefetch}}) if exists $thing{prefetch};
This page took 0.00954 seconds and 4 git commands to generate.