From 4077e2863e5f07917ee59534bfc4a1a5197baa64 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Thu, 1 Jan 2026 10:18:13 +0000 Subject: fix: fix wrapped feature to only show bookmarks in 2025 --- packages/trpc/models/users.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/trpc/models/users.ts b/packages/trpc/models/users.ts index b1719200..5d3c3785 100644 --- a/packages/trpc/models/users.ts +++ b/packages/trpc/models/users.ts @@ -872,12 +872,22 @@ export class User { } async hasWrapped(): Promise { + // Check for bookmarks created in 2025 + const yearStart = new Date("2025-01-01T00:00:00Z"); + const yearEnd = new Date("2025-12-31T23:59:59Z"); + const [{ numBookmarks }] = await this.ctx.db .select({ numBookmarks: count(bookmarks.id), }) .from(bookmarks) - .where(eq(bookmarks.userId, this.user.id)); + .where( + and( + eq(bookmarks.userId, this.user.id), + gte(bookmarks.createdAt, yearStart), + lte(bookmarks.createdAt, yearEnd), + ), + ); return numBookmarks >= 20; } -- cgit v1.2.3-70-g09d2