kohabug 2437 Corrects LIMIT offset algorithm
Because of a miscalculation in the offset algorithm, the LIMIT offset creeps backwards by a magnitude for every page beyond page two. This patch corrects the algorithm to behave as expected. Signed-off-by: Galen Charlton <galen.charlton@liblime.com> Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
953a46a088
commit
606f72b97a
1 changed files with 2 additions and 2 deletions
|
@ -66,9 +66,9 @@ sub shelfpage ($$$$$) {
|
||||||
my ($shelflimit, $shelfoffset, $shelveslimit, $shelvesoffset);
|
my ($shelflimit, $shelfoffset, $shelveslimit, $shelvesoffset);
|
||||||
# FIXME: These limits should not be hardcoded...
|
# FIXME: These limits should not be hardcoded...
|
||||||
$shelflimit = 20; # Limits number of items returned for a given query
|
$shelflimit = 20; # Limits number of items returned for a given query
|
||||||
$shelfoffset = (($itemoff == 1) ? 0 : ($itemoff * 10)); # Sets the offset to begin retrieving items at
|
$shelfoffset = ($itemoff - 1) * 20; # Sets the offset to begin retrieving items at
|
||||||
$shelveslimit = 20; # Limits number of shelves returned for a given query (row_count)
|
$shelveslimit = 20; # Limits number of shelves returned for a given query (row_count)
|
||||||
$shelvesoffset = (($shelfoff == 1) ? 0 : ($shelfoff * 10)); # Sets the offset to begin retrieving shelves at (offset)
|
$shelvesoffset = ($shelfoff - 1) * 20; # Sets the offset to begin retrieving shelves at (offset)
|
||||||
# getting the Shelves list
|
# getting the Shelves list
|
||||||
my $category = (($displaymode eq 'privateshelves') ? 1 : 2);
|
my $category = (($displaymode eq 'privateshelves') ? 1 : 2);
|
||||||
my ($shelflist, $totshelves) = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser );
|
my ($shelflist, $totshelves) = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser );
|
||||||
|
|
Loading…
Reference in a new issue