From db91084c3cf4e3d26f6925c61b882c068832ae56 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 1 Jul 2022 19:12:59 -0500 Subject: fix total pages --- src/cleaners/skyblock/auctions.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/cleaners/skyblock/auctions.ts') diff --git a/src/cleaners/skyblock/auctions.ts b/src/cleaners/skyblock/auctions.ts index d70767d..a43001b 100644 --- a/src/cleaners/skyblock/auctions.ts +++ b/src/cleaners/skyblock/auctions.ts @@ -29,6 +29,8 @@ export async function cleanAuctions(data: typedHypixelApi.SkyBlockRequestAuction // sort by newer first rawAuctions.sort((a, b) => b.start - a.start) + const totalPages = Math.ceil(rawAuctions.length / PAGE_SIZE) + rawAuctions = rawAuctions.slice(page * PAGE_SIZE, page * PAGE_SIZE + PAGE_SIZE) for (const auction of rawAuctions) { @@ -37,7 +39,7 @@ export async function cleanAuctions(data: typedHypixelApi.SkyBlockRequestAuction const auctions = await Promise.all(auctionPromises) - return { auctions, pages: Math.ceil(rawAuctions.length / PAGE_SIZE) } + return { auctions, pages: totalPages } } async function cleanAuction(auction: typedHypixelApi.SkyBlockRequestAuctionResponse['auctions'][number]): Promise { -- cgit