Skip to content

Scheduling infrastructure for absolutely everyone.

perf: Insights - put teamId filter first (#16581)

Keith Williamsbe9b0fb9a802
diff --git a/packages/features/insights/server/trpc-router.ts b/packages/features/insights/server/trpc-router.ts
index 11a95a6cdb2..e2953eae0d0 100644
--- a/packages/features/insights/server/trpc-router.ts
+++ b/packages/features/insights/server/trpc-router.ts
@@ -209,18 +209,18 @@ export const insightsRouter = router({
whereConditional = {
...whereConditional,
OR: [
- {
- userId: {
- in: userIdsFromOrg,
- },
- isTeamBooking: false,
- },
{
teamId: {
in: [ctx.user.organizationId, ...teamsFromOrg.map((t) => t.id)],
},
isTeamBooking: true,
},
+ {
+ userId: {
+ in: userIdsFromOrg,
+ },
+ isTeamBooking: false,
+ },
],
};
}
@@ -436,18 +436,18 @@ export const insightsRouter = router({
whereConditional = {
OR: [
- {
- userId: {
- in: userIdsFromOrg,
- },
- isTeamBooking: false,
- },
{
teamId: {
in: [ctx.user.organizationId, ...teamsFromOrg.map((t) => t.id)],
},
isTeamBooking: true,
},
+ {
+ userId: {
+ in: userIdsFromOrg,
+ },
+ isTeamBooking: false,
+ },
],
};
}
@@ -614,18 +614,18 @@ export const insightsRouter = router({
bookingWhere = {
...bookingWhere,
OR: [
- {
- userId: {
- in: userIdsFromOrg,
- },
- isTeamBooking: false,
- },
{
teamId: {
in: [ctx.user.organizationId, ...teamsFromOrg.map((t) => t.id)],
},
isTeamBooking: true,
},
+ {
+ userId: {
+ in: userIdsFromOrg,
+ },
+ isTeamBooking: false,
+ },
],
};
}