Skip to content

Commit bec49ef

Browse files
fix: provide meetingStartTime for test preview to prevent 'Meeting start time is required' crash (#24379)
* fix: provide meetingStartTime for test preview to prevent RR timestamp error When Round Robin timestamp basis is set to START_TIME, the system requires a meeting start time to calculate the interval for load balancing. Test Preview doesn't have a real meeting time since it's just simulating the routing logic. This fix provides the current time (new Date()) as the meetingStartTime when calling getOrderedListOfLuckyUsers in test preview mode. This allows the Round Robin calculation to proceed using the current interval for realistic ordering while still being in preview mode. Fixes the 'Meeting start time is required' error that occurs when users click Test Preview on routing forms with Round Robin timestamp basis set to START_TIME. Co-Authored-By: [email protected] <[email protected]> * add comment --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent c13aa69 commit bec49ef

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/trpc/server/routers/viewer/routing-forms/findTeamMembersMatchingAttributeLogicOfRoute.handler.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import type { ServerResponse } from "http";
77
import type { NextApiResponse } from "next";
88

99
import { enrichFormWithMigrationData } from "@calcom/app-store/routing-forms/enrichFormWithMigrationData";
10+
import { getLuckyUserService } from "@calcom/features/di/containers/LuckyUser";
1011
import { getUrlSearchParamsToForwardForTestPreview } from "@calcom/features/routing-forms/lib/getUrlSearchParamsToForward";
1112
import { enrichHostsWithDelegationCredentials } from "@calcom/lib/delegationCredential/server";
12-
import { getLuckyUserService } from "@calcom/features/di/containers/LuckyUser";
1313
import { entityPrismaWhereClause } from "@calcom/lib/entityPermissionUtils.server";
1414
import { fromEntriesWithDuplicateKeys } from "@calcom/lib/fromEntriesWithDuplicateKeys";
1515
import { findTeamMembersMatchingAttributeLogic } from "@calcom/lib/raqb/findTeamMembersMatchingAttributeLogic";
@@ -296,6 +296,8 @@ export const findTeamMembersMatchingAttributeLogicOfRouteHandler = async ({
296296
form,
297297
chosenRouteId: route.id,
298298
},
299+
// During Preview testing we could consider the current time itself as the meeting start time
300+
meetingStartTime: new Date(),
299301
})
300302
: { users: [], perUserData: null, isUsingAttributeWeights: false };
301303
const timeAfterGetOrderedLuckyUsers = performance.now();

0 commit comments

Comments
 (0)