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

split date ranges for calling /freebusy endpoint #11962

Merged
merged 4 commits into from
Oct 26, 2023

Conversation

CarinaWolli
Copy link
Member

@CarinaWolli CarinaWolli commented Oct 18, 2023

What does this PR do?

Follow up from #11696 (comment)

The Google /freeBusy endpoint has a maximum time span of 90 days. However, in the column view longer timespans can happen. With this PR the duration is segmented into shorter timespans.

Fixes #11704

Type of change

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

How should this be tested?

  • Connect google calendar and toggle a calendar to check for conflicts
  • Edit the default availability that is associated with the event type you will use for testing:
    • Enable only one day of the week
    • Create several date overrides to disable a few of the available days
  • Go to to column view of the event type
  • Now this should show all available days and if the timespan of the 6 days shown is more than 90 days then this would have failed before

@vercel
Copy link

vercel bot commented Oct 18, 2023

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

Name Status Preview Comments Updated (UTC)
ai ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 19, 2023 3:03pm
api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 19, 2023 3:03pm
cal-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 19, 2023 3:03pm
dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 19, 2023 3:03pm
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Oct 19, 2023 3:03pm
qa ⬜️ Ignored (Inspect) Visit Preview Oct 19, 2023 3:03pm
ui ⬜️ Ignored (Inspect) Visit Preview Oct 19, 2023 3:03pm

@github-actions
Copy link
Contributor

github-actions bot commented Oct 18, 2023

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "split date ranges for calling  /freebusy endpoint". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@zomars zomars added the core area: core, team members only label Oct 18, 2023
const diff = originalEndDate.diff(originalStartDate, "days");

// /freebusy from google api only allows a date range of 90 days
if (diff <= 90) {
Copy link
Member Author

Choose a reason for hiding this comment

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

similar logic as we have it for zohocalendar

@github-actions
Copy link
Contributor

github-actions bot commented Oct 18, 2023

📦 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! 🙌

});
return c;
}, [] as Prisma.PromiseReturnType<CalendarService["getAvailability"]>);
return result;
}

async getAvailability(
Copy link
Member Author

Choose a reason for hiding this comment

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

Unsure how to write a test for this. @joeauyeung Do we already have tests for google calendar

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't have any merged yet but it's in the works.

@CarinaWolli CarinaWolli marked this pull request as ready for review October 18, 2023 10:15
@CarinaWolli CarinaWolli requested a review from a team October 18, 2023 10:15
@CarinaWolli CarinaWolli added the Medium priority Created by Linear-GitHub Sync label Oct 18, 2023
@@ -369,57 +370,75 @@ export default class GoogleCalendarService implements Calendar {
timeMin: string;
timeMax: string;
items: { id: string }[];
}): Promise<calendar_v3.Schema$FreeBusyResponse> {
}): Promise<EventBusyDate[] | null> {
Copy link
Member Author

Choose a reason for hiding this comment

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

The only thing that changed in the getCacheOrFetchAvailability function is that we return nowEventBusyDate[] instead of calendar_v3.Schema$FreeBusyResponse

@deploysentinel
Copy link

deploysentinel bot commented Oct 18, 2023

Current Playwright Test Results Summary

✅ 182 Passing - ⚠️ 6 Flaky

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

(Last updated on 10/19/2023 03:07:18pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: a44cb33

Started: 10/19/2023 03:04:26pm UTC

⚠️ Flakes

📄   apps/web/playwright/integrations-stripe.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Stripe integration When event is paid and confirmed Cancelled paid booking should be refunded
Retry 1Initial Attempt
0.65% (2) 2 / 309 runs
failed over last 7 days
2.59% (8) 8 / 309 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/action-based.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
Popup Tests should open embed iframe on click - Configured with light theme
Retry 1Initial Attempt
3.14% (10) 10 / 318 runs
failed over last 7 days
36.79% (117) 117 / 318 runs
flaked over last 7 days
Popup Tests should be able to reschedule
Retry 1Initial Attempt
8.20% (26) 26 / 317 runs
failed over last 7 days
89.91% (285) 285 / 317 runs
flaked over last 7 days

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

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
FORM_SUBMITTED on submitting user form, triggers user webhook
Retry 1Initial Attempt
0% (0) 0 / 307 runs
failed over last 7 days
2.93% (9) 9 / 307 runs
flaked over last 7 days

📄   apps/web/playwright/change-username.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Change username on settings User can change username
Retry 1Initial Attempt
0.32% (1) 1 / 312 run
failed over last 7 days
20.83% (65) 65 / 312 runs
flaked over last 7 days

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

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Availablity tests Date Overrides
Retry 1Initial Attempt
4.13% (13) 13 / 315 runs
failed over last 7 days
1.90% (6) 6 / 315 runs
flaked over last 7 days

View Detailed Build Results


Copy link
Contributor

@joeauyeung joeauyeung left a comment

Choose a reason for hiding this comment

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

LGTM

Timeslots are being blocked in both Oct and Feb

@CarinaWolli CarinaWolli merged commit c2a57fd into main Oct 26, 2023
36 of 37 checks passed
@CarinaWolli CarinaWolli deleted the fix/split-date-ranges branch October 26, 2023 14:29
@zomars
Copy link
Member

zomars commented Oct 26, 2023

BTW This is conflicting with my calendar cache PR #11928 😢

@CarinaWolli
Copy link
Member Author

BTW This is conflicting with my calendar cache PR #11928 😢

Should I help merge it into your branch? Or how would you wanna handle it?

@zomars
Copy link
Member

zomars commented Oct 26, 2023

I tagged you in a comment explaining my solution. Let me know if t achieves se same effect. Also I do need the raw gCal response in order to use in the inbound webhook. Hence all other changes for this PR were reverted.

hbjORbj pushed a commit to codemod-com/cal.com-demo that referenced this pull request Nov 28, 2023
Co-authored-by: CarinaWolli <wollencarina@gmail.com>
hbjORbj pushed a commit to codemod-com/cal.com-demo that referenced this pull request Dec 21, 2023
Co-authored-by: CarinaWolli <wollencarina@gmail.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 Medium priority Created by Linear-GitHub Sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-2579] Split time range for /freeBusy request to google
3 participants