fix: recurring events with calendar connections#12250
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
4 Ignored Deployments
|
|
Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link to collect XP and win prizes! |
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
Current Playwright Test Results Summary✅ 313 Passing - Run may still be in progress, this comment will be updated as current testing workflow or job completes... (Last updated on 11/07/2023 02:52:50pm UTC) Run DetailsRunning Workflow PR Update on Github Actions Commit: f61971a Started: 11/07/2023 02:43:19pm UTC
|
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Event Types tests user can add multiple organizer address
Retry 1 • Initial Attempt |
0.44% (1)1 / 228 runfailed over last 7 days |
10.09% (23)23 / 228 runsflaked over last 7 days |
📄 apps/web/playwright/teams.e2e.ts • 2 Flakes
Top 1 Common Error Messages
|
|
2 Test Cases Affected |
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Teams - NonOrg Can create teams via Wizard
Retry 1 • Initial Attempt |
0% (0)0 / 215 runsfailed over last 7 days |
1.40% (3)3 / 215 runsflaked over last 7 days |
|
Teams - NonOrg Non admin team members cannot create team in org
Retry 1 • Initial Attempt |
0% (0)0 / 215 runsfailed over last 7 days |
40.47% (87)87 / 215 runsflaked over last 7 days |
📄 apps/web/playwright/insights.e2e.ts • 2 Flakes
Top 1 Common Error Messages
|
|
2 Test Cases Affected |
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Insights should be able to go to insights as members
Retry 1 • Initial Attempt |
0% (0)0 / 228 runsfailed over last 7 days |
4.82% (11)11 / 228 runsflaked over last 7 days |
|
Insights should test download button
Retry 1 • Initial Attempt |
0% (0)0 / 228 runsfailed over last 7 days |
6.14% (14)14 / 228 runsflaked over last 7 days |
📄 packages/embeds/embed-core/playwright/tests/inline.e2e.ts • 1 Flake
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Inline Iframe Inline Iframe - Configured with Dark Theme
Retry 1 • Initial Attempt |
1.31% (3)3 / 229 runsfailed over last 7 days |
28.38% (65)65 / 229 runsflaked over last 7 days |
📄 packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 1 Flake
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Popup Tests should be able to reschedule
Retry 1 • Initial Attempt |
20.51% (48)48 / 234 runsfailed over last 7 days |
73.93% (173)173 / 234 runsflaked over last 7 days |
| const dateStrings = times.map((t) => { | ||
| // finally; show in local timeZone again | ||
| return processDate(t.tz(timeZone), language, { selectedTimeFormat, withDefaultTimeFormat }); | ||
| return processDate(t.tz(timeZone), language, { selectedTimeFormat, withDefaultTimeFormat }, timeZone); |
There was a problem hiding this comment.
What is the exact bug that this change fixes?
| date: string | null | Dayjs, | ||
| language: string, | ||
| options?: ExtraOptions, | ||
| timeZone?: string |
There was a problem hiding this comment.
If we really need timezone to show the correct time here, shouldn't we make it required and fix everywhere it's missing.
| } else { | ||
| foundConflict = checkForConflicts(bufferedBusyTimes, input.dateFrom, duration); | ||
| } | ||
| foundConflict = checkForConflicts(bufferedBusyTimes, input.dateFrom, duration); |
There was a problem hiding this comment.
The change looks good. I was already removing it as part of https://github.com/calcom/cal.com/pull/11774/files
But the interesting thing is that I was thinking that it was dead code but actually it was failing some bookings.
Did some investigation as to how just enabling a calendar was failing Recurring bookings
- When Calendar is enabled, we don't just fetch the busyTimes for the current slot being booked but instead we fetch till the end of the month(some weird reason for this). This isn't true for
busyTimesfetched from DB. There it's just for the range of the timeslot being booked as expected. The behaviour changed here 5 months back. So, I believe it has been broken for 5 straight months now. - Due to this, when a single timeslot was checked for conflicts with busytimes, it was actually checking conflicts with busyTime of a recurring timeslot that was just booked in the previous iteration and thus it was always failing.
So, great find @CarinaWolli 👏
hariombalhara
left a comment
There was a problem hiding this comment.
Requesting changes to get clarity on timezone related change, otherwise it's good.
|
Great find, @CarinaWolli. Any tests we could add to make sure this continues to work? |
| // DONE: Decreased computational complexity from O(2^n) to O(n) by refactoring this loop to stop | ||
| // running at the first unavailable time. | ||
| let i = 0; | ||
| while (!foundConflict && i < allBookingDates.length) { |
There was a problem hiding this comment.
The issue here was that every recurring date called the handler starting with with the last booking (see: book/recurring-event.ts)
So when the handler was called for the first booking (recurringDatesInfo?.currentRecurringIndex === 0) the calendar events for the other dates already existed and the checkForConflicts function found a conflict
| : options?.selectedTimeFormat || detectBrowserTimeFormat | ||
| ); | ||
| return `${formattedTime}, ${dayjs(date).toDate().toLocaleString(language, { dateStyle: "full" })}`; | ||
| return `${formattedTime}, ${dayjs(date) |
I don't think we have a setup yet for testing calendar connections. I think @joeauyeung is working on that. That would be needed to test this |
Ok. I thought by looking at the code it would be possible for us to unit test/mock the data this function receives, not necessarily coming from a real calendar connection. We'll push this PR through to get the bug fixed but let's look into this possibility in a follow-up PR. |
Reason for change requested was addressed
Co-authored-by: CarinaWolli <wollencarina@gmail.com>

What does this PR do?
Fixes that when booking a recurring event with a calendar connection it was always throwing 'no available users found':

This error was also thrown when user was available on all the recurring dates.
Type of change
How should this be tested?
Mandatory Tasks
Checklist