cal/packages
Carina Wollendorfer 270d4f6e82
fix: round-robin booked out of availability (#12376)
## What does this PR do?

Fixes that it can happen that Round Robin host is booked outside of availability. 

I found and fixed the following two scenarios where this can happen: 
- when host has a date override
- when host is available for only a part the event time (for example, booking time 9:00-11:00 and user is only available between 10:00-11:00)

Fixes #10315
Fixes #11690

It also fixes that it can happen that round robin doesn't correctly pick the luck user (least recently booked). This happened when a user was an attendee of a booking before, then we always compared this booking and never the actual last booking of this user. 

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How should this be tested?

#### Booked outside of availability: 
1. 
- Create Round Robin event and assign user1 and user2 as round robin hosts
   - event duration: 120 minutes 
- user 1 availability: 
  - Monday to Friday 9:00-17:00
- user2 availability: 
  - Monday to Friday 10:00-17:00
- Book event at a 9:00 slot -> check if i user1 is booked 
- Book event again at a 9:00 slot -> check if user1 is booked again (user2 is not available at that time)

2.
- Change availability of user2
   - Mark Monday as unavailable 
   -   Add date override on any day this month 
- Book any Monday this month -> see that user 1 is booked 
- Again Book any Monday this month -> see that user 1 is booked again 

#### Wrong lucky user 
- Book event and add user1's email as the attendee email address
- Book several slots where both users should be available, and see that it alternates between user1 and user2 (before it ended up always booking user1)

## Mandatory Tasks

- [ ] Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.
2023-11-15 12:49:03 -07:00
..
app-store feat: Stripe paid apps flow (#12103) 2023-11-15 09:29:41 -03:00
app-store-cli refactor: Use template literal instead of '+' operator (#11444) 2023-10-03 11:52:19 -07:00
atoms refactor: rename `AtomsProvider` to `CalProvider` (#12375) 2023-11-15 16:14:37 +00:00
config feat: km-localization-cambodia 🇰🇭 (#12027) 2023-10-23 12:02:45 +00:00
core fix: Fix 'Book a new time' link in request-reschedule for Team Event (#12261) 2023-11-14 13:23:44 -07:00
dayjs Add changesets/cli to release embed (#8126) 2023-05-13 08:22:31 +00:00
debugging chore: prettier 2023-08-15 11:59:16 -07:00
emails chore: [CAL-2654] Broken Icons in org invitation email (#12119) 2023-10-31 20:00:07 +00:00
embeds fix: Embed: data-cal-origin not used by modal(which is used by both element click popup and floating button popup) (#12075) 2023-11-02 19:39:58 +00:00
eslint-plugin Add changesets/cli to release embed (#8126) 2023-05-13 08:22:31 +00:00
features fix: round-robin booked out of availability (#12376) 2023-11-15 12:49:03 -07:00
lib fix: round-robin booked out of availability (#12376) 2023-11-15 12:49:03 -07:00
prisma feat: Stripe paid apps flow (#12103) 2023-11-15 09:29:41 -03:00
trpc fix avatar remove button (#12249) 2023-11-15 15:23:33 +05:30
tsconfig We're not ready for this yet 2022-11-22 20:02:40 -07:00
types feat: Stripe paid apps flow (#12103) 2023-11-15 09:29:41 -03:00
ui feat: Stripe paid apps flow (#12103) 2023-11-15 09:29:41 -03:00