From ade823f1357e667a201c64a17d9ec4359733418e Mon Sep 17 00:00:00 2001 From: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Date: Wed, 28 Jan 2026 14:33:58 +0000 Subject: [PATCH] sort team Ids (#27349) --- .../features/insights/services/InsightsBookingBaseService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/features/insights/services/InsightsBookingBaseService.ts b/packages/features/insights/services/InsightsBookingBaseService.ts index 329cfd2596..c8ec588add 100644 --- a/packages/features/insights/services/InsightsBookingBaseService.ts +++ b/packages/features/insights/services/InsightsBookingBaseService.ts @@ -406,7 +406,7 @@ export class InsightsBookingBaseService { parentId: options.orgId, select: { id: true }, }); - const teamIds = [options.orgId, ...teamsFromOrg.map((t) => t.id)]; + const teamIds = [options.orgId, ...teamsFromOrg.map((t) => t.id)].sort((a, b) => a - b); // Get all users from the organization const userIdsFromOrg = @@ -419,7 +419,7 @@ export class InsightsBookingBaseService { const conditions: Prisma.Sql[] = [Prisma.sql`("teamId" = ANY(${teamIds})) AND ("isTeamBooking" = true)`]; if (userIdsFromOrg.length > 0) { - const uniqueUserIds = Array.from(new Set(userIdsFromOrg)); + const uniqueUserIds = Array.from(new Set(userIdsFromOrg)).sort((a, b) => a - b); conditions.push(Prisma.sql`("userId" = ANY(${uniqueUserIds})) AND ("isTeamBooking" = false)`); }