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

This commit is contained in:
Alex van Andel 2023-02-24 01:22:18 +00:00 committed by GitHub
parent 1dbdb8a4d4
commit 8a6a7524cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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") || {};