Skip to content

Commit

Permalink
Fix off-by-one error affecting pagination
Browse files Browse the repository at this point in the history
This was reorganized in 9d60740.
The var comparison was moved to after the var was incremented
but the offset wasn't adjusted accordingly.

Closes gh-608.
... and all the duplicates.
  • Loading branch information
rwstauner committed Apr 4, 2013
1 parent b01ebe3 commit 2ab339a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/MetaCPAN/Web/Model/API/Module.pm
Expand Up @@ -120,7 +120,8 @@ sub search_collapsed {
$run++;
} while ( @distributions < 20 + $from
&& $data->{hits}->{total}
&& $data->{hits}->{total} > $hits + ( $run - 1 ) * $RESULTS_PER_RUN );
&& $data->{hits}->{total} > $hits + ( $run - 2 ) * $RESULTS_PER_RUN
);

@distributions = splice( @distributions, $from, 20 );
my $ratings = $self->model('Rating')->get(@distributions);
Expand Down

0 comments on commit 2ab339a

Please sign in to comment.