Skip to content

Commit

Permalink
fix: paginate last button
Browse files Browse the repository at this point in the history
  • Loading branch information
forgetfulskybro committed Dec 27, 2023
1 parent 19b87df commit 0b47dc2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
18 changes: 12 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/buttons/paginateLast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ const button: Button = {

if (
type === "leaderboard" &&
!paginate.countedPages.includes(paginate.page)
!paginate.countedPages.includes(paginate.pages.length - 1)
) {
paginate.countedPages.push(paginate.page);
paginate.countedPages.push(paginate.pages.length - 1);

data = await UserModel.find({
"higherlower.highscore": { $gt: 1 },
})
.sort({ "higherlower.highscore": -1 })
.skip(paginate.page * 10)
.skip((paginate.pages.length - 1) * 10)
.limit(10);

data = await Promise.all(
Expand Down

0 comments on commit 0b47dc2

Please sign in to comment.