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

feat: add date overrides to availability settings atom #15459

Conversation

Ryukemeister
Copy link
Contributor

@Ryukemeister Ryukemeister commented Jun 17, 2024

What does this PR do?

  • Adds date override feature for Availability Settings atom, this was previously not possible in v2 because of how the schedules api was structured. With the recent schedules refactor we now have date overrides for atoms as well.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected)
  • I have added a Docs issue here if this PR makes changes that would require a documentation change
  • I have added or modified automated tests that prove my fix is effective or that my feature works (PRs might be rejected if logical changes are not properly tested)

How should this be tested?

This can be tested in the platform examples app

Copy link

linear bot commented Jun 17, 2024

@CLAassistant
Copy link

CLAassistant commented Jun 17, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
3 out of 4 committers have signed the CLA.

✅ Ryukemeister
✅ ThyMinimalDev
✅ supalarry
❌ Rajiv Sahal


Rajiv Sahal seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

vercel bot commented Jun 17, 2024

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

3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview Jun 19, 2024 0:15am
cal ⬜️ Ignored (Inspect) Visit Preview Jun 19, 2024 0:15am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Jun 19, 2024 0:15am

@keithwillcode keithwillcode added core area: core, team members only platform Anything related to our platform plan labels Jun 17, 2024
</div>
) : (
<></>
{enableOverrides && (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

enableOverrides prop allows users to enable or disable date overrides inside an atom

date: `${range.start.getUTCFullYear}-${range.start.getUTCMonth}-${range.start.getUTCDate}`,
startTime: `${range.start.getUTCHours}-${range.start.getUTCMinutes}`,
endTime: `${range.end.getUTCHours}-${range.end.getUTCMinutes}`,
date: `${range.start.getUTCFullYear()}-${range.start.getUTCMonth()}-${range.start.getUTCDate()}`,
Copy link
Contributor Author

@Ryukemeister Ryukemeister Jun 17, 2024

Choose a reason for hiding this comment

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

While transforming the overrides data into data suitable for v2 api inside of the function transformAtomScheduleForApi none of the functions were being invoked and this was causing the requests to fail with an internal server error.

@dosubot dosubot bot added the ✨ feature New feature or request label Jun 17, 2024
@graphite-app graphite-app bot requested a review from a team June 17, 2024 17:18
Copy link

graphite-app bot commented Jun 17, 2024

Graphite Automations

"Add platform team as reviewer" took an action on this PR • (06/17/24)

1 reviewer was added to this PR based on Keith Williams's automation.

@supalarry
Copy link
Contributor

There were problems when overrides were being formatted for API:

  1. Date needed to have "+1" because Date.getMonth() returns values from 0 to 11, not 1 to 12.
  2. The month, day of the date and start hours and end hours needed to be padded with zeroes.

In commit fix: date overrides formatting for api request I fixed it.

Before

Screenshot 2024-06-18 at 09 59 46

After

Screenshot 2024-06-18 at 10 15 38

Copy link
Contributor

@supalarry supalarry left a comment

Choose a reason for hiding this comment

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

With fix above can confirm that it's possible to create date override and that it is reflected during booker's available times.

@ThyMinimalDev ThyMinimalDev added this pull request to the merge queue Jun 19, 2024
Merged via the queue into main with commit d2d7453 Jun 19, 2024
23 of 24 checks passed
@ThyMinimalDev ThyMinimalDev deleted the rajiv/cal-3851-add-date-overrides-to-availability-settings-atom branch June 19, 2024 12:36
p6l-richard pushed a commit to p6l-richard/cal.com-fork that referenced this pull request Jul 22, 2024
* remove console.log

* fixup: logic to convert overrides was not calling functions

* refactor handleSubmit function

* add portal to platform dialog component

* cleanup

* add props to enable and disable date overrides

* show date overrides for availability settings atom

* fix: date overrides formatting for api request

---------

Co-authored-by: Rajiv Sahal <rajivsahal@Rajivs-MacBook-Pro.local>
Co-authored-by: supalarry <laurisskraucis@gmail.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core area: core, team members only ✨ feature New feature or request platform Anything related to our platform plan
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants