@@ -2,7 +2,7 @@ import EventManager from "@calcom/core/EventManager";
2
2
import dayjs from "@calcom/dayjs" ;
3
3
import { sendRoundRobinCancelledEmails , sendRoundRobinScheduledEmails } from "@calcom/emails" ;
4
4
import { ensureAvailableUsers , getEventTypesFromDB } from "@calcom/features/bookings/lib/handleNewBooking" ;
5
- import type { User } from "@calcom/features/bookings/lib/handleNewBooking" ;
5
+ import type { IsFixedAwareUser } from "@calcom/features/bookings/lib/handleNewBooking" ;
6
6
import { scheduleEmailReminder } from "@calcom/features/ee/workflows/lib/reminders/emailReminderManager" ;
7
7
import logger from "@calcom/lib/logger" ;
8
8
import { getLuckyUser } from "@calcom/lib/server" ;
@@ -24,14 +24,13 @@ export const roundRobinReassignment = async ({
24
24
} ) ;
25
25
26
26
const eventType = await getEventTypesFromDB ( eventTypeId ) ;
27
- console . log ( "🚀 ~ eventType:" , eventType . hosts [ 0 ] . user . credentials ) ;
28
27
29
28
if ( ! eventType ) {
30
29
console . error ( `Event type ${ eventTypeId } not found` ) ;
31
30
throw new Error ( "Event type not found" ) ;
32
31
}
33
32
34
- eventType . users = eventType . hosts . map ( ( host ) => ( { ...host . user } ) ) ;
33
+ eventType . users = eventType . hosts . map ( ( host ) => ( { ...host . user , isFixed : host . isFixed } ) ) ;
35
34
36
35
const roundRobinHosts = eventType . hosts . filter ( ( host ) => ! host . isFixed ) ;
37
36
@@ -92,12 +91,12 @@ export const roundRobinReassignment = async ({
92
91
const previousRRHostT = await getTranslation ( previousRRHost ?. locale || "en" , "common" ) ;
93
92
94
93
// Filter out the current attendees of the booking from the event type
95
- const availableEventTypeUsers = eventType . users . reduce ( ( availableUsers , user ) => {
96
- if ( ! attendeeEmailsSet . has ( user . email ) && user . email !== originalOrganizer . email ) {
97
- availableUsers . push ( user ) ;
94
+ const availableEventTypeUsers = eventType . hosts . reduce ( ( availableUsers , host ) => {
95
+ if ( ! attendeeEmailsSet . has ( host . user . email ) && host . user . email !== originalOrganizer . email ) {
96
+ availableUsers . push ( { ... host . user } ) ;
98
97
}
99
98
return availableUsers ;
100
- } , [ ] as User [ ] ) ;
99
+ } , [ ] as IsFixedAwareUser [ ] ) ;
101
100
102
101
const availableUsers = await ensureAvailableUsers (
103
102
{ ...eventType , users : availableEventTypeUsers } ,
0 commit comments