cal/packages/lib
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
..
apps feat: Alby integration (#11495) 2023-09-28 12:03:01 +00:00
browser chore: add canonical to the document via `PageWrapper` (#8639) 2023-06-02 18:28:03 +00:00
cva refactor: Moving from jest to vitest (#9035) 2023-05-24 23:35:44 +00:00
date-fns fix: add missing booking paid webhook trigger to dropdwon (#10237) 2023-07-18 19:46:53 +00:00
hooks feat: added /enterprise upgrade tip (#12207) 2023-11-13 13:55:28 +02:00
payment fix: meeting url variable in workflow notifitcations (#12308) 2023-11-13 09:28:15 -05:00
server fix: round-robin booked out of availability (#12376) 2023-11-15 12:49:03 -07:00
sync chore: update `tslog` from 3.2.1 to 4.9.2 (#11717) 2023-10-17 19:00:48 +00:00
test feat: Lock timezone on booking page (#11891) 2023-10-25 14:16:01 -04:00
array.ts New Booker Component (preparations for booker atom) (#6792) 2023-04-24 16:32:30 +02:00
availability.ts refactor: Use template literal instead of '+' operator (#11444) 2023-10-03 11:52:19 -07:00
bookingSuccessRedirect.ts chore: [app dir bootstrapping 4] check nullability of navigation hook return values (#12005) 2023-10-20 16:47:05 -07:00
CalendarService.ts chore: update `tslog` from 3.2.1 to 4.9.2 (#11717) 2023-10-17 19:00:48 +00:00
CalEventParser.ts refactor: Use template literal instead of '+' operator (#11444) 2023-10-03 11:52:19 -07:00
checkIfItFallbackImage.ts fix avatar remove button (#12249) 2023-11-15 15:23:33 +05:30
checkRateLimitAndThrowError.test.ts feat: ratelimit - ratelimit refactor + tests (#9744) 2023-06-26 19:44:58 +00:00
checkRateLimitAndThrowError.ts hotfix: unreachable rate limits 2023-10-23 15:14:01 -07:00
classNames.ts Tailwind Merge (#6596) 2023-01-20 15:19:12 +01:00
CloseCom.ts chore: update `tslog` from 3.2.1 to 4.9.2 (#11717) 2023-10-17 19:00:48 +00:00
CloseComeUtils.ts refactor: Use template literal instead of '+' operator (#11444) 2023-10-03 11:52:19 -07:00
constants.ts chore: [app dir bootstrapping 10] adds ab tests middleware (#12045) 2023-11-15 11:06:18 -07:00
convertToNewDurationType.ts Fixed wrong calculation of duration type on event type page. (#5557) 2022-11-17 13:38:03 +05:30
crypto.ts refactor: Use template literal instead of '+' operator (#11444) 2023-10-03 11:52:19 -07:00
date-ranges.test.ts fix: Fix "Could not book the meeting" issue (fix-bookingIssue) (#12252) 2023-11-07 12:33:49 -03:00
date-ranges.ts fix: Fix "could not book the meeting" issue (fix-confirmBookingIssue) (#12305) 2023-11-09 18:43:48 -03:00
default-cookies.ts test: Hotfix/Orgs rewrite causing 404 with 3 or more dots domains (#9803) 2023-06-27 12:01:30 -07:00
defaultAvatarImage.ts refactor: Use template literal instead of '+' operator (#11444) 2023-10-03 11:52:19 -07:00
defaultEvents.ts feat: Lock timezone on booking page (#11891) 2023-10-25 14:16:01 -04:00
deriveAppDictKeyFromType.ts Chore/salesforce prep work (#5648) 2022-11-22 13:44:08 -07:00
entityPermissionUtils.ts feat: Routing Forms/Teams Support (#9417) 2023-06-15 08:58:07 +00:00
env.ts Feature: Verify login on signup with magic link. (#2122) 2022-04-21 14:32:25 -06:00
errors.ts resolves #3565 (#8581) 2023-05-02 16:56:29 +00:00
fetch-wrapper.ts New Booker Component (preparations for booker atom) (#6792) 2023-04-24 16:32:30 +02:00
fetchUsername.ts feature/settings-username-update (#2306) 2022-07-06 13:31:07 -06:00
findDurationType.ts Enforces explicit type imports (#7158) 2023-02-16 15:39:57 -07:00
getAvatarUrl.ts fix: Avatar slug and cal links for cross org users (#12031) 2023-10-24 16:12:36 +05:30
getBooking.tsx perf: bookings query improvement (#10687) 2023-08-24 11:14:10 +02:00
getBrandColours.test.ts refactor: Moving from jest to vitest (#9035) 2023-05-24 23:35:44 +00:00
getBrandColours.tsx fix: app crashing due to invalid hex (#11542) 2023-09-27 10:58:52 -03:00
getEventTypeById.ts feat: Lock timezone on booking page (#11891) 2023-10-25 14:16:01 -04:00
getIP.ts use cloudflare real IP (#10449) 2023-07-28 15:11:44 +00:00
getLabelValueMapFromResponses.ts Fix: Send responses in confirm booking flow (#7830) 2023-03-27 13:57:10 +05:30
getLocaleFromRequest.ts fix: Revert deletion of getLocaleFromRequest in #11534 (#11835) 2023-10-11 17:36:32 +00:00
getMetadataHelpers.ts feat: admin org list now shows all, dns check added (#10875) 2023-08-23 21:01:12 +00:00
getPaymentAppData.ts feat: Enable Apps for Teams & Orgs [CAL-1782] (#9337) 2023-07-06 16:48:39 +00:00
getSafeRedirectUrl.ts Make sure returnTo is correct URL (#6189) 2023-01-05 12:55:55 -07:00
getTeamIdFromEventType.ts fix: Managed Event Type Webhooks (#10300) 2023-07-25 13:05:02 -04:00
getValidRhfFieldName.test.ts fix: Make identifier conform to RHF field requirement (#10860) 2023-08-21 13:11:47 -04:00
getValidRhfFieldName.ts fix: Make identifier conform to RHF field requirement (#10860) 2023-08-21 13:11:47 -04:00
hasEditPermissionForUser.ts Import prisma (#11358) 2023-09-14 09:18:19 -03:00
hasKeyInMetadata.ts feature/settings-username-update (#2306) 2022-07-06 13:31:07 -06:00
http-error.ts Stripe to monorepo (#2063) 2022-03-09 15:56:05 -07:00
i18n.ts fix: Prevents mixed server and client code (#10909) 2023-08-23 16:25:43 +00:00
index.ts [CAL-988] Limit total appointment time per day/week/month/year (#7166) 2023-03-10 21:00:19 +01:00
intervalLimit.ts fix: all booking and duration limits (#10480) 2023-08-09 15:51:38 -07:00
invertLogoOnDark.ts fix: inverted logos and new logo for cal video (#11633) 2023-10-02 11:36:37 +01:00
isBookingLimits.ts feat(lib): add more tests to lib package (#7210) 2023-03-10 22:10:56 +00:00
isDurationLimits.ts [CAL-988] Limit total appointment time per day/week/month/year (#7166) 2023-03-10 21:00:19 +01:00
isKeyInObject.ts Adds basic global feature flags (#7459) 2023-03-24 17:59:04 -07:00
isMac.ts Adds a fully extensible command(ctrl)+k interface for Cal (#3346) 2022-07-14 06:45:07 +00:00
isOutOfBounds.tsx add an enum generator, stop importing from @prisma/client (#8548) 2023-05-02 13:44:05 +02:00
isPrismaObj.ts License server (#2379) 2022-05-26 11:07:14 -06:00
isProblematicTimezone.ts Fix: Filter Timezones by cities (#7540) 2023-03-06 17:52:20 +00:00
isRecurringEvent.ts feat(lib): add more tests to lib package (#7210) 2023-03-10 22:10:56 +00:00
jsonUtils.ts App Store (#1869) 2022-03-23 15:00:30 -07:00
logger.ts chore: update `tslog` from 3.2.1 to 4.9.2 (#11717) 2023-10-17 19:00:48 +00:00
markdownIt.ts Fixes formatted description in email + sanitize html everywhere (#7928) 2023-03-28 09:40:13 +00:00
markdownToSafeHTML.ts perf: Booker bundle size optimization - Remove `sanitize-html` dependency on client (#10801) 2023-08-16 11:03:21 -07:00
next-seo.config.ts chore: ensure compat type definitions do not break existing types (#11741) 2023-10-10 14:50:15 -07:00
notEmpty.ts App Store (#1869) 2022-03-23 15:00:30 -07:00
objectKeys.ts Enables strict mode in nextjs apps (#2354) 2022-04-04 20:26:14 +00:00
OgImages.tsx fix: add inline color in og image (#11280) 2023-09-12 00:08:27 +02:00
package.json chore: update `tslog` from 3.2.1 to 4.9.2 (#11717) 2023-10-17 19:00:48 +00:00
parse-dates.ts fix: recurring events with calendar connections (#12250) 2023-11-07 12:09:56 -03:00
parse-zone.ts New Booker Component (preparations for booker atom) (#6792) 2023-04-24 16:32:30 +02:00
perf.ts perf: lazy load tRPC routes (#8167) 2023-04-25 19:39:47 -03:00
piiFreeData.ts feat: Stripe paid apps flow (#12103) 2023-11-15 09:29:41 -03:00
price.ts feat: Alby integration (#11495) 2023-09-28 12:03:01 +00:00
random.test.ts refactor: Moving from jest to vitest (#9035) 2023-05-24 23:35:44 +00:00
random.ts feat(lib): add more tests to lib package (#7210) 2023-03-10 22:10:56 +00:00
rateLimit.ts chore: update `tslog` from 3.2.1 to 4.9.2 (#11717) 2023-10-17 19:00:48 +00:00
recurringStrings.ts Enforces explicit type imports (#7158) 2023-02-16 15:39:57 -07:00
redactError.ts chore: update `tslog` from 3.2.1 to 4.9.2 (#11717) 2023-10-17 19:00:48 +00:00
safeStringify.ts test: More tests in booking flow (#11510) 2023-09-30 13:28:52 +00:00
sanitizeCalendarObject.ts Caldav/refactor: Mutiple Fixes and General code improvement (#8031) 2023-04-12 14:30:39 -03:00
Sendgrid.ts chore: update `tslog` from 3.2.1 to 4.9.2 (#11717) 2023-10-17 19:00:48 +00:00
serverConfig.ts fix: #10614 - made nodemailer compatible with mailhog smtp server. (#10615) 2023-08-10 18:19:21 +01:00
slots.test.ts feat: configure availability time picker interval by env variable (#12174) 2023-11-09 09:50:42 -05:00
slots.ts feat: configure availability time picker interval by env variable (#12174) 2023-11-09 09:50:42 -05:00
slugify.test.ts fix: allow dots in username (#11706) 2023-10-23 13:37:30 +01:00
slugify.ts fix: allow dots in username (#11706) 2023-10-23 13:37:30 +01:00
stripMarkdown.ts fix: strip markdown from meta description tag in users page (#8769) 2023-05-15 07:44:23 +00:00
telemetry.ts refactor: Use template literal instead of '+' operator (#11444) 2023-10-03 11:52:19 -07:00
testEmails.ts fix: Requires Confirmation when organizer reschedules (#11848) 2023-10-13 10:22:57 -07:00
text.test.ts refactor: Moving from jest to vitest (#9035) 2023-05-24 23:35:44 +00:00
text.ts feat(lib): add more tests to lib package (#7210) 2023-03-10 22:10:56 +00:00
timeFormat.ts feat: dynamic time format rendering in workflows based on user settings (#10229) 2023-07-19 10:30:37 -04:00
timezone.ts fix: Change Detroit to New York as a default for EST time zone (#8218) 2023-05-29 19:57:34 +01:00
totp.ts fix: add 2fa and email verification grace period (#10771) 2023-08-17 16:13:04 +02:00
tsconfig.json feat(lib): add more tests to lib package (#7210) 2023-03-10 22:10:56 +00:00
tsconfig.test.json feat(lib): add more tests to lib package (#7210) 2023-03-10 22:10:56 +00:00
turndownService.ts fix: Italics not being shown in the description after saving (#10848) 2023-08-24 11:20:00 +01:00
validateBookerLayouts.ts feat: event settings booker layout toggle (#9082) 2023-06-06 15:31:43 +00:00
validateIntervalLimitOrder.ts fix: all booking and duration limits (#10480) 2023-08-09 15:51:38 -07:00
validateUsername.ts fix: org username check for dynamic and signup (#11390) 2023-09-15 13:06:56 -03:00
webstorage.ts Add removeItem to webstorage 2023-11-11 11:16:35 +00:00
weekday.test.ts refactor: Moving from jest to vitest (#9035) 2023-05-24 23:35:44 +00:00
weekday.ts feat(lib): add more tests to lib package (#7210) 2023-03-10 22:10:56 +00:00