aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-21 16:32:01 -0500
committermat <github@matdoes.dev>2022-05-21 16:32:01 -0500
commitd85e645d903c48fee0b5593400f23f69c1b2786a (patch)
tree813b508970bdba5bd21d4bf7237706ed8a5d4fae /src
parentbd37b154913ed7c75abe08ec6a66945849f705be (diff)
downloadskyblock-api-d85e645d903c48fee0b5593400f23f69c1b2786a.tar.gz
skyblock-api-d85e645d903c48fee0b5593400f23f69c1b2786a.tar.bz2
skyblock-api-d85e645d903c48fee0b5593400f23f69c1b2786a.zip
fix profile sorting
Diffstat (limited to 'src')
-rw-r--r--src/hypixelCached.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hypixelCached.ts b/src/hypixelCached.ts
index cf055da..d94d1f5 100644
--- a/src/hypixelCached.ts
+++ b/src/hypixelCached.ts
@@ -274,8 +274,8 @@ export async function fetchSkyblockProfiles(playerUuid: string): Promise<CleanPr
basicProfiles.sort((a, b) => {
const memberA = a.members?.find(m => m.uuid === playerUuid)
const memberB = b.members?.find(m => m.uuid === playerUuid)
- if (!memberA || !memberB || !memberA.lastSave || !memberB.lastSave) return 0
- return memberB.lastSave - memberA.lastSave
+
+ return (memberB?.lastSave ?? 0) - (memberA?.lastSave ?? 0)
})
// cache the profiles