Skip to content

Commit

Permalink
Fix pagination so it returns the proper number of items on a page.
Browse files Browse the repository at this point in the history
    Makes the "?per_page=N&page_num=M" work properly.
  • Loading branch information
Misterblue committed Dec 30, 2020
1 parent 12f31a4 commit 249b26d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Entities/EntityFilters/PaginationInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ export class PaginationInfo extends CriteriaFilter {
public criteriaTest(pThingy: any): boolean {
if (! this._doingQuery) {
this.TotalEntries++;
if (++this._currentItem > this.PerPage) {
if (this._currentItem > this.PerPage) {
this._currentItem = 1;
++this._currentPage;
}
};
// Logger.debug(`Pagination: curItem=${this._currentItem}, curP=${this._currentPage}, perPg=${this.PerPage}, total=${this.TotalEntries}`);
this._currentItem++;
return this.PageNum === this._currentPage;
};
return true;
Expand Down

0 comments on commit 249b26d

Please sign in to comment.