Skip to content

Scheduling infrastructure for absolutely everyone.

sort team Ids (#27349)

sean-brydonade823f1357e
diff --git a/packages/features/insights/services/InsightsBookingBaseService.ts b/packages/features/insights/services/InsightsBookingBaseService.ts
index 329cfd25969..c8ec588add2 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)`);
}