Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: No available users found #13738

Merged
merged 20 commits into from
Feb 20, 2024
Merged

fix: No available users found #13738

merged 20 commits into from
Feb 20, 2024

Conversation

keithwillcode
Copy link
Contributor

@keithwillcode keithwillcode commented Feb 16, 2024

What does this PR do?

Fixes #13311, #13747, #13709

Type of change

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

How should this be tested?

  • ensure test suite passes
  • ensure that you can book 1 individual slot on a future date that is only available because a date override has been set

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

@keithwillcode keithwillcode added the Urgent Created by Linear-GitHub Sync label Feb 16, 2024
@keithwillcode keithwillcode added this to the v3.9 milestone Feb 16, 2024
@keithwillcode keithwillcode requested a review from a team February 16, 2024 23:20
@keithwillcode keithwillcode self-assigned this Feb 16, 2024
Copy link
Contributor

github-actions bot commented Feb 16, 2024

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link.

@keithwillcode keithwillcode added core area: core, team members only foundation labels Feb 16, 2024
Copy link

vercel bot commented Feb 16, 2024

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

4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2024 2:07pm
cal ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2024 2:07pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2024 2:07pm
qa ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2024 2:07pm

@@ -339,15 +339,25 @@ export async function ensureAvailableUsers(
});
}

const getStartTime = (startTimeInput: string, timeZone?: string) => {
Copy link
Contributor Author

@keithwillcode keithwillcode Feb 16, 2024

Choose a reason for hiding this comment

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

This code was taken from packages/trpc/server/routers/viewers/slots/util.ts so that we mirror how the getUserAvailability function is called.

I noticed that the .utc() function was being called for the endTime but not the startTime. Have added that here and will look to see if util.ts needs it to be added as well.

Copy link
Contributor

@MehulZR MehulZR Feb 17, 2024

Choose a reason for hiding this comment

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

Is the startTimeInput in Zulu format or something like 2024-10-01T05:00 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

If it isn't in Zulu format or ISO format. It reads the time in local tz. So if you run dayjs("2024-10-01T05:00") in India.

  1. It will be 2024-10-01T05:00:00+05:30.
  2. Then we convert it into the specified timezone.
  3. And then to UTC.

Which I guess isn't what we want.

I think here we are thinking of reading 2024-10-01T05:00 in the specified timezone.
For that you need to do something like dayjs.tz(2024-10-01T05:00, timeZone)

Copy link
Contributor

@MehulZR MehulZR Feb 17, 2024

Choose a reason for hiding this comment

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

And I guess github actions are run in UTC tz, so It won't show any errors. And the productions server will be fine to as long as it is in UTC too.

Just my 2 cents, as I have been working with dayjs alot in recent days and have gone through many gotchas.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's in ISO format with the timezone information included. So, for example, if on the booking page you select New York for the time zone, it will pass 2024-02-17T12:00:00-05:00.

Copy link
Contributor Author

@keithwillcode keithwillcode Feb 17, 2024

Choose a reason for hiding this comment

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

The main problem is that we were calling stringToDayjs with this string and it was never being converted to UTC before doing all the appropriate checks and so the time slots weren't lining up properly, resulting in "No available users found" errors.

Copy link
Contributor

github-actions bot commented Feb 16, 2024

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link

deploysentinel bot commented Feb 16, 2024

Current Playwright Test Results Summary

✅ 81 Passing - ⚠️ 4 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 02/20/2024 03:04:43pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 6997ab4

Started: 02/20/2024 03:01:17pm UTC

⚠️ Flakes

📄   apps/web/playwright/login.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
user can login & logout succesfully -- future login flow user & logout using dashboard
Retry 1Initial Attempt
0.42% (1) 1 / 239 run
failed over last 7 days
43.51% (104) 104 / 239 runs
flaked over last 7 days

📄   apps/web/playwright/event-types.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Event Types tests -- future user can add multiple organizer address
Retry 1Initial Attempt
0% (0) 0 / 245 runs
failed over last 7 days
18.78% (46) 46 / 245 runs
flaked over last 7 days
Event Types tests -- legacy user Different Locations Tests can add single organizer address location without display location public option
Retry 1Initial Attempt
0.41% (1) 1 / 244 run
failed over last 7 days
2.87% (7) 7 / 244 runs
flaked over last 7 days

📄   apps/web/playwright/impersonation.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Users can impersonate App Admin can impersonate users with impersonation enabled
Retry 1Initial Attempt
0% (0) 0 / 244 runs
failed over last 7 days
10.66% (26) 26 / 244 runs
flaked over last 7 days

View Detailed Build Results


@github-actions github-actions bot added High priority Created by Linear-GitHub Sync 🧹 Improvements Improvements to existing features. Mostly UX/UI labels Feb 17, 2024
@keithwillcode keithwillcode marked this pull request as ready for review February 20, 2024 03:25

describe("Booking for slot only available by date override:", () => {
test(
`should be able to create a booking for the exact slot overridden`,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

First wrote this test against main and saw it fail. Then made it pass in this branch.

@keithwillcode keithwillcode added 🐛 bug Something isn't working and removed High priority Created by Linear-GitHub Sync 🧹 Improvements Improvements to existing features. Mostly UX/UI labels Feb 20, 2024
zomars
zomars previously approved these changes Feb 20, 2024
Copy link
Member

@zomars zomars left a comment

Choose a reason for hiding this comment

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

Very nice!

Copy link
Member

@CarinaWolli CarinaWolli left a comment

Choose a reason for hiding this comment

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

Fix looks good, did a lot of testing and everything worked for me. When testing I found one more case were this error is thrown, I left a comment

@keithwillcode keithwillcode marked this pull request as draft February 20, 2024 13:18
@github-actions github-actions bot added the 🧹 Improvements Improvements to existing features. Mostly UX/UI label Feb 20, 2024
@keithwillcode keithwillcode merged commit 7157448 into main Feb 20, 2024
39 checks passed
@keithwillcode keithwillcode deleted the fix/cannot-book-ny-tz branch February 20, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working core area: core, team members only foundation 🧹 Improvements Improvements to existing features. Mostly UX/UI Urgent Created by Linear-GitHub Sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-2965] Remove No users found error
4 participants