Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/airdrop/streak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plotlink",
"version": "0.1.29",
"version": "0.1.30",
"private": true,
"workspaces": [
"packages/*"
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/airdrop/checkin/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading