Skip to content

Scheduling infrastructure for absolutely everyone.

Prioritise organizer to be the fixed, not lucky (round robin) user (#7317)

Alex van Andel8a6a7524cc87
diff --git a/packages/features/bookings/lib/handleNewBooking.ts b/packages/features/bookings/lib/handleNewBooking.ts
index cda99effe4b..5a86c0b4481 100644
--- a/packages/features/bookings/lib/handleNewBooking.ts
+++ b/packages/features/bookings/lib/handleNewBooking.ts
@@ -474,7 +474,8 @@ async function handler(req: NextApiRequest & { userId?: number | undefined }) {
) {
throw new Error("Some users are unavailable for booking.");
}
- users = [...luckyUsers, ...availableUsers.filter((user) => user.isFixed)];
+ // Pushing fixed user before the luckyUser guarantees the (first) fixed user as the organizer.
+ users = [...availableUsers.filter((user) => user.isFixed), ...luckyUsers];
}
const rainbowAppData = getEventTypeAppData(eventType, "rainbow") || {};