From 85dd10640324dc7682d397d6c35e89383dba488a Mon Sep 17 00:00:00 2001 From: Cho Young-Hwi Date: Tue, 21 Apr 2026 19:00:53 +0900 Subject: [PATCH] [#916] Fix streak tier drop logic to drop to previous tier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dropOneTier was snapping to the current tier threshold instead of dropping to the one below. E.g. streak 50 stayed at 50 instead of dropping to 30. Fixed: streak now drops to previous tier (100→50, 50→30, 30→14, 14→7, 7→0). Fixes #916 Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/airdrop/streak.ts | 8 ++++---- package.json | 2 +- src/app/api/airdrop/checkin/route.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/airdrop/streak.ts b/lib/airdrop/streak.ts index 87202c84..506a23a4 100644 --- a/lib/airdrop/streak.ts +++ b/lib/airdrop/streak.ts @@ -25,14 +25,14 @@ export function getStreakBoost(currentStreak: number): number { /** * Drop one tier after a missed day. Returns the new streak value. - * Per spec: streak snaps down to the current tier's threshold. - * 100+ → 100, 50-99 → 50, 30-49 → 30, 14-29 → 14, 7-13 → 7, 1-6 → 0 + * Per spec: streak drops to the previous tier's threshold. + * 100+ → 50, 50-99 → 30, 30-49 → 14, 14-29 → 7, 7-13 → 0, 1-6 → 0 */ export function dropOneTier(streak: number): number { - // Find the current tier and snap to its threshold + // Find the current tier and drop to the one below it for (let i = TIER_THRESHOLDS.length - 1; i >= 0; i--) { if (streak >= TIER_THRESHOLDS[i]) { - return TIER_THRESHOLDS[i]; + return i > 0 ? TIER_THRESHOLDS[i - 1] : 0; } } return 0; diff --git a/package.json b/package.json index d69bab56..00464f7f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plotlink", - "version": "0.1.29", + "version": "0.1.30", "private": true, "workspaces": [ "packages/*" diff --git a/src/app/api/airdrop/checkin/route.ts b/src/app/api/airdrop/checkin/route.ts index 53825bec..5d7d8a80 100644 --- a/src/app/api/airdrop/checkin/route.ts +++ b/src/app/api/airdrop/checkin/route.ts @@ -102,7 +102,7 @@ export async function POST(req: Request) { // Consecutive day — increment streak newStreak = existing.current_streak + 1; } else { - // Missed 2+ days — snap to current tier threshold + // Missed 2+ days — drop to previous tier threshold newStreak = dropOneTier(existing.current_streak); } } else {