From 2453c45b063bb23374f02af83d94500fd28c46c7 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 1 Jun 2021 22:20:42 -0400 Subject: [PATCH] Don't use undefined lockedSum from cache --- src/utils/reputation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/reputation.ts b/src/utils/reputation.ts index 0ca1c78..d40857c 100644 --- a/src/utils/reputation.ts +++ b/src/utils/reputation.ts @@ -38,7 +38,7 @@ export async function getReputation(userID: UserID): Promise { return 0; } - return convertRange(Math.min(result.upvotedSum, 150), 5, 150, 0, 7) + convertRange(Math.min(result.lockedSum, 50), 0, 50, 0, 20); + return convertRange(Math.min(result.upvotedSum, 150), 5, 150, 0, 7) + convertRange(Math.min(result.lockedSum ?? 0, 50), 0, 50, 0, 20); } function convertRange(value: number, currentMin: number, currentMax: number, targetMin: number, targetMax: number): number {