aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/auctions.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-07-01 19:12:59 -0500
committermat <github@matdoes.dev>2022-07-01 19:12:59 -0500
commitdb91084c3cf4e3d26f6925c61b882c068832ae56 (patch)
treedf6a4150ec850a48f8d1b2aec7a42718af346a1e /src/cleaners/skyblock/auctions.ts
parent11f0b9762dd85adfbe746c4c7406410ea0fdd8a7 (diff)
downloadskyblock-api-db91084c3cf4e3d26f6925c61b882c068832ae56.tar.gz
skyblock-api-db91084c3cf4e3d26f6925c61b882c068832ae56.tar.bz2
skyblock-api-db91084c3cf4e3d26f6925c61b882c068832ae56.zip
fix total pages
Diffstat (limited to 'src/cleaners/skyblock/auctions.ts')
-rw-r--r--src/cleaners/skyblock/auctions.ts4
1 files changed, 3 insertions, 1 deletions
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<Auction> {