Skip to content

Commit 594b22d

Browse files
committed
improve dethroning logic
1 parent 242121a commit 594b22d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/modules/core/bump.listener.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,12 @@ export async function handleBumpStreak(
6464
// check if the user dethroned another user
6565

6666
const allStreaks = getStreaks(extractStreaks(await getAllBumps()));
67-
if (allStreaks.length > 1) {
68-
const mostRecent = allStreaks[allStreaks.length - 2];
67+
if (
68+
allStreaks.length > 1 &&
69+
streak.current === 1 // just started a new streak
70+
) {
71+
// allStreaks[-1] will be the current streak
72+
const mostRecent = allStreaks[allStreaks.length - 2]; // so check the one before that
6973
logger.debug(`Most recent streak:`, mostRecent);
7074
logger.debug(
7175
"Most recent streaks:",

0 commit comments

Comments
 (0)