Remove error if team members and hosts do not match (#21598)

This commit is contained in:
Joe Au-Yeung authored and GitHub committed 2025-05-30 08:31:34 +00:00
1 parent 8753a6e4d6
commit d8145bbc78
1 file changed
+3 -4
@@ -255,16 +255,15 @@ export const findTeamMembersMatchingAttributeLogicOfRouteHandler = async ({
}
const matchingTeamMembersIds = matchingTeamMembersWithResult.map((member) => member.userId);
const matchingTeamMembers = await UserRepository.findByIds({ ids: matchingTeamMembersIds });
const matchingHosts = await enrichHostsWithDelegationCredentials({
orgId: formOrgId,
hosts: eventType.hosts.filter((host) => matchingTeamMembersIds.includes(host.user.id)),
});
if (matchingTeamMembers.length !== matchingHosts.length) {
if (!matchingHosts.length) {
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
message: "Looks like not all matching team members are assigned to the event",
message: "No matching team members found",
});
}
@@ -273,7 +272,7 @@ export const findTeamMembersMatchingAttributeLogicOfRouteHandler = async ({
users: orderedLuckyUsers,
perUserData,
isUsingAttributeWeights,
} = matchingTeamMembers.length
} = matchingHosts.length
? await getOrderedListOfLuckyUsers({
// Assuming all are available
availableUsers: [