Skip to content

Collective events are now considered from getBusyTimes booking query#6911

Merged
emrysal merged 4 commits intocalcom:mainfrom
AaronPresley:bug/6374-collective-busy
Feb 13, 2023
Merged

Collective events are now considered from getBusyTimes booking query#6911
emrysal merged 4 commits intocalcom:mainfrom
AaronPresley:bug/6374-collective-busy

Conversation

@AaronPresley
Copy link
Copy Markdown
Contributor

@AaronPresley AaronPresley commented Feb 7, 2023

What does this PR do?

Fixes #6374

This PR updates the getBusyTimes query to consider a user busy within a given time period if:

  • There is a booking owned by this user (previous functionality)
  • There is a booking with an eventType.id in which this user is a host

Environment: Staging(main branch) / Production

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

  1. Clean your DB by running yarn db-nuke from within packages/prisma
  2. Boot the app from the root with yarn dx
  3. Login as teampro@example.com / teampro
  4. Create a new Event Type for the Team Pro user
  5. Edit Collective Seeded Team Event > Assignment > include the Team Pro user > Save
  6. In an incognito browser, book a meeting under Collective Seeded Team Event
  7. In an incognito browser, check the availability for the Event Type you created in Step 4

In Production you will see that the Team Pro user is considered available for the time slot booked in Step 6

In this PR you will see that the Team Pro user is considered unavailable for the time slot booked in Step 3

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have updated existing unit tests to pass locally with my changes

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated
ui ⬜️ Ignored (Inspect) Feb 7, 2023 at 0:37AM (UTC)

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 7, 2023

@AaronPresley is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@AaronPresley
Copy link
Copy Markdown
Contributor Author

@emrysal @PeerRich this one's ready for review 👍 It took a while to crawl through the schema to figure out the best way to gather this data, but I eventually figured out that the Host table is the best source. I've left a lot of comments in the code itself to explain the flow.

Also, I noticed there's some performance testing around this function (named prismaBookingGetStart and prismaBookingGetEnd). I'm guessing there will be a bit of time added to this query, but hoping it's minimal.

@emrysal please let me know if you envisioned this lookup happening a different way. Thanks!

Comment thread packages/core/getBusyTimes.ts
@AaronPresley AaronPresley requested a review from emrysal February 10, 2023 17:01
Copy link
Copy Markdown
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot re-create the problem (assume I was just looking wrong) - Approved @AaronPresley 🙇

@emrysal emrysal enabled auto-merge (squash) February 13, 2023 12:46
@emrysal emrysal merged commit d59cda3 into calcom:main Feb 13, 2023
@AaronPresley AaronPresley deleted the bug/6374-collective-busy branch February 13, 2023 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-736] Collective events are ignored from getBusyTimes booking query

2 participants