aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-07-01 18:11:54 -0500
committermat <github@matdoes.dev>2022-07-01 18:11:54 -0500
commita241602974da4effa14dab0b7876d533f1225e93 (patch)
treed43c414bfe664880672830c819d76f917b454d34 /src/cleaners/skyblock
parent06071107fd3e2d7cd697a97844fb4520fef55fe0 (diff)
downloadskyblock-api-a241602974da4effa14dab0b7876d533f1225e93.tar.gz
skyblock-api-a241602974da4effa14dab0b7876d533f1225e93.tar.bz2
skyblock-api-a241602974da4effa14dab0b7876d533f1225e93.zip
page size 20
Diffstat (limited to 'src/cleaners/skyblock')
-rw-r--r--src/cleaners/skyblock/auctions.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cleaners/skyblock/auctions.ts b/src/cleaners/skyblock/auctions.ts
index bec922c..d70767d 100644
--- a/src/cleaners/skyblock/auctions.ts
+++ b/src/cleaners/skyblock/auctions.ts
@@ -20,6 +20,7 @@ export interface Auction {
item: Item
}
+const PAGE_SIZE = 20
export async function cleanAuctions(data: typedHypixelApi.SkyBlockRequestAuctionResponse, page: number): Promise<Auctions> {
const auctionPromises: Promise<Auction>[] = []
@@ -28,7 +29,7 @@ export async function cleanAuctions(data: typedHypixelApi.SkyBlockRequestAuction
// sort by newer first
rawAuctions.sort((a, b) => b.start - a.start)
- rawAuctions = rawAuctions.slice(page * 10, page * 10 + 10)
+ rawAuctions = rawAuctions.slice(page * PAGE_SIZE, page * PAGE_SIZE + PAGE_SIZE)
for (const auction of rawAuctions) {
auctionPromises.push(cleanAuction(auction))
@@ -36,7 +37,7 @@ export async function cleanAuctions(data: typedHypixelApi.SkyBlockRequestAuction
const auctions = await Promise.all(auctionPromises)
- return { auctions, pages: Math.ceil(rawAuctions.length / 10) }
+ return { auctions, pages: Math.ceil(rawAuctions.length / PAGE_SIZE) }
}
async function cleanAuction(auction: typedHypixelApi.SkyBlockRequestAuctionResponse['auctions'][number]): Promise<Auction> {