-
Notifications
You must be signed in to change notification settings - Fork 0
perf: Don't process date overrides outside of requested boundaries #12
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
base: eval-pr-13495-target-1763590614259
Are you sure you want to change the base?
perf: Don't process date overrides outside of requested boundaries #12
Conversation
|
Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 2 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="packages/lib/date-ranges.ts">
<violation number="1" location="packages/lib/date-ranges.ts:109">
Date overrides that share the start day of the request window are now skipped because the comparison uses the override’s midnight timestamp against the exact `dateFrom` time rather than day boundaries, so any request starting after midnight on that day drops a valid override.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| const groupedDateOverrides = groupByDate( | ||
| availability.reduce((processed: DateRange[], item) => { | ||
| if ("date" in item && !!item.date) { | ||
| if ("date" in item && !!item.date && item.date >= dateFrom && item.date <= dateTo) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Date overrides that share the start day of the request window are now skipped because the comparison uses the override’s midnight timestamp against the exact dateFrom time rather than day boundaries, so any request starting after midnight on that day drops a valid override.
Prompt for AI agents
Address the following comment on packages/lib/date-ranges.ts at line 109:
<comment>Date overrides that share the start day of the request window are now skipped because the comparison uses the override’s midnight timestamp against the exact `dateFrom` time rather than day boundaries, so any request starting after midnight on that day drops a valid override.</comment>
<file context>
@@ -106,7 +106,7 @@ export function buildDateRanges({
const groupedDateOverrides = groupByDate(
availability.reduce((processed: DateRange[], item) => {
- if ("date" in item && !!item.date) {
+ if ("date" in item && !!item.date && item.date >= dateFrom && item.date <= dateTo) {
processed.push(processDateOverride({ item, timeZone }));
}
</file context>
[internal] Confidence score: 7/10
[internal] Posted by: General AI Review Agent
|
@cubic-dev-local review this |
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
2 similar comments
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 2 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="packages/lib/date-ranges.ts">
<violation number="1" location="packages/lib/date-ranges.ts:109">
Date overrides on the first/last requested day are now skipped because the new guard compares the midnight override date with the exact request timestamps; convert both sides to day boundaries before filtering.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| const groupedDateOverrides = groupByDate( | ||
| availability.reduce((processed: DateRange[], item) => { | ||
| if ("date" in item && !!item.date) { | ||
| if ("date" in item && !!item.date && item.date >= dateFrom && item.date <= dateTo) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Date overrides on the first/last requested day are now skipped because the new guard compares the midnight override date with the exact request timestamps; convert both sides to day boundaries before filtering.
Prompt for AI agents
Address the following comment on packages/lib/date-ranges.ts at line 109:
<comment>Date overrides on the first/last requested day are now skipped because the new guard compares the midnight override date with the exact request timestamps; convert both sides to day boundaries before filtering.</comment>
<file context>
@@ -106,7 +106,7 @@ export function buildDateRanges({
const groupedDateOverrides = groupByDate(
availability.reduce((processed: DateRange[], item) => {
- if ("date" in item && !!item.date) {
+ if ("date" in item && !!item.date && item.date >= dateFrom && item.date <= dateTo) {
processed.push(processDateOverride({ item, timeZone }));
}
</file context>
[internal] Confidence score: 7/10
[internal] Posted by: General AI Review Agent
| if ("date" in item && !!item.date && item.date >= dateFrom && item.date <= dateTo) { | |
| if ("date" in item && !!item.date && dayjs(item.date).isBetween(dateFrom.startOf("day"), dateTo.endOf("day"), null, "[]")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 2 files
|
@cubic-dev-local review this |
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
2 similar comments
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
|
@cubic-dev-local review this |
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
2 similar comments
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 2 files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 2 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="packages/lib/date-ranges.ts">
<violation number="1" location="packages/lib/date-ranges.ts:109">
Filtering date overrides by `item.date >= dateFrom` drops all overrides for the first requested day whenever `dateFrom` includes a time-of-day, so first-day overrides no longer adjust availability.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| const groupedDateOverrides = groupByDate( | ||
| availability.reduce((processed: DateRange[], item) => { | ||
| if ("date" in item && !!item.date) { | ||
| if ("date" in item && !!item.date && item.date >= dateFrom && item.date <= dateTo) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filtering date overrides by item.date >= dateFrom drops all overrides for the first requested day whenever dateFrom includes a time-of-day, so first-day overrides no longer adjust availability.
Prompt for AI agents
Address the following comment on packages/lib/date-ranges.ts at line 109:
<comment>Filtering date overrides by `item.date >= dateFrom` drops all overrides for the first requested day whenever `dateFrom` includes a time-of-day, so first-day overrides no longer adjust availability.</comment>
<file context>
@@ -106,7 +106,7 @@ export function buildDateRanges({
const groupedDateOverrides = groupByDate(
availability.reduce((processed: DateRange[], item) => {
- if ("date" in item && !!item.date) {
+ if ("date" in item && !!item.date && item.date >= dateFrom && item.date <= dateTo) {
processed.push(processDateOverride({ item, timeZone }));
}
</file context>
[internal] Confidence score: 8/10
[internal] Posted by: General AI Review Agent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 2 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="packages/lib/date-ranges.ts">
<violation number="1" location="packages/lib/date-ranges.ts:109">
Filtering overrides by raw timestamp drops valid same-day overrides when `dateFrom` is later than midnight. Compare whole-day boundaries instead of exact timestamps to keep overrides that occur on the first/last day of the requested window.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| const groupedDateOverrides = groupByDate( | ||
| availability.reduce((processed: DateRange[], item) => { | ||
| if ("date" in item && !!item.date) { | ||
| if ("date" in item && !!item.date && item.date >= dateFrom && item.date <= dateTo) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filtering overrides by raw timestamp drops valid same-day overrides when dateFrom is later than midnight. Compare whole-day boundaries instead of exact timestamps to keep overrides that occur on the first/last day of the requested window.
Prompt for AI agents
Address the following comment on packages/lib/date-ranges.ts at line 109:
<comment>Filtering overrides by raw timestamp drops valid same-day overrides when `dateFrom` is later than midnight. Compare whole-day boundaries instead of exact timestamps to keep overrides that occur on the first/last day of the requested window.</comment>
<file context>
@@ -106,7 +106,7 @@ export function buildDateRanges({
const groupedDateOverrides = groupByDate(
availability.reduce((processed: DateRange[], item) => {
- if ("date" in item && !!item.date) {
+ if ("date" in item && !!item.date && item.date >= dateFrom && item.date <= dateTo) {
processed.push(processDateOverride({ item, timeZone }));
}
</file context>
[internal] Confidence score: 8/10
[internal] Posted by: General AI Review Agent
|
@cubic-dev-local review this |
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
1 similar comment
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
|
@cubic-dev-local review this |
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
1 similar comment
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
|
@cubic-dev-local review this |
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
1 similar comment
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
|
@cubic-dev-local review this |
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
1 similar comment
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
|
@cubic-dev-local review this |
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
1 similar comment
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
|
@cubic-dev-local review this |
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
1 similar comment
@sanxroz I've started the AI code review. It'll take a few minutes to complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 2 files
|
This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active. |
Fixes calcom#13358.
Date overrides on user's availability settings were being added to the list of slots and their calculations even when the overrides fell outside of the start/end window of the requested schedule.
Type of change
How should this be tested?
Mandatory Tasks
Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.
Based on: perf: Don't process date overrides outside of requested boundaries calcom/cal.com#13495
Summary by cubic
Skip processing date overrides that fall outside the requested start/end window. This prevents off-window overrides from affecting available slots and reduces unnecessary work.
Bug Fixes
Performance
Written for commit 0b01219. Summary will update automatically on new commits.