Skip to content

feat: Add option to include no shows in RR calculations #21063

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

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

joeauyeung
Copy link
Contributor

@joeauyeung joeauyeung commented May 1, 2025

What does this PR do?

  • Fixes #XXXX (GitHub issue number)
  • Fixes CAL-XXXX (Linear issue number - should be visible at the bottom of the GitHub issue description)

Visual Demo (For contributors especially)

A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).

Video Demo (if applicable):

  • Show screen recordings of the issue or feature.
  • Demonstrate how to reproduce the issue, the behavior before and after the change.

Image Demo (if applicable):

  • Add side-by-side screenshots of the original and updated change.
  • Highlight any significant change(s).

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings

Summary by mrge

Added an option to include no-show bookings in round robin (RR) calculations for event types.

  • New Features
    • Added a toggle in the event type settings to include or exclude no-shows from RR host assignment.
    • Updated backend logic and database schema to support this option.

@github-actions github-actions bot added the ❗️ migrations contains migration files label May 1, 2025
@keithwillcode keithwillcode added core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO labels May 1, 2025
Copy link

vercel bot commented May 1, 2025

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

Name Status Preview Comments Updated (UTC)
cal 🛑 Canceled (Inspect) May 2, 2025 3:14am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview May 2, 2025 3:14am

</RadioArea.Group>
)}
/>
{schedulingType === "ROUND_ROBIN" && (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only show the RR distribution box for RR events

Comment on lines +52 to +56
...(!includeNoShowInRRCalculation
? {
OR: [{ noShowHost: false }, { noShowHost: null }],
}
: {}),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only if includeNoShow... is false then we add the noShowHost conditional

@@ -66,7 +65,7 @@ const buildWhereClauseForActiveBookings = ({
},
},
],
attendees: { some: { noShow: false } },
...(!includeNoShowInRRCalculation ? { attendees: { some: { noShow: false } } } : {}),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here for the attendee no show prop

@@ -164,6 +164,7 @@ model EventType {
isRRWeightsEnabled Boolean @default(false)
fieldTranslations EventTypeTranslation[]
maxLeadThreshold Int?
includeNoShowInRRCalculation Boolean @default(false)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the only change in the schema. Others are just auto formatting

@@ -814,6 +815,7 @@ export class EventTypeRepository {
rrSegmentQueryValue: true,
isRRWeightsEnabled: true,
maxLeadThreshold: true,
includeNoShowInRRCalculation: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Heads up @CarinaWolli the same logic that we use for determining the luckyUser is also used in getAvailableSlots. I added this as it was throwing a type error.

@joeauyeung joeauyeung marked this pull request as ready for review May 2, 2025 02:42
@joeauyeung joeauyeung requested review from a team as code owners May 2, 2025 02:42
@graphite-app graphite-app bot requested a review from a team May 2, 2025 02:42
@dosubot dosubot bot added event-types area: event types, event-types ✨ feature New feature or request labels May 2, 2025
Copy link

graphite-app bot commented May 2, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (05/02/25)

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

Copy link

@mrge-io mrge-io bot left a comment

Choose a reason for hiding this comment

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

mrge found 6 issues across 16 files. View them in mrge.io

@@ -98,6 +98,7 @@ export const filterHostsByLeadThreshold = async <T extends BaseHost<BaseUser>>({
parentId?: number | null;
rrResetInterval: RRResetInterval | null;
} | null;
includeNoShowInRRCalculation: boolean;
Copy link

Choose a reason for hiding this comment

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

Missing documentation for the new property that explains its purpose and impact on round robin calculations

@@ -67,6 +67,7 @@ interface GetLuckyUserParams<T extends PartialUser> {
id: number;
isRRWeightsEnabled: boolean;
team: { parentId?: number | null; rrResetInterval: RRResetInterval | null } | null;
includeNoShowInRRCalculation: boolean;
Copy link

Choose a reason for hiding this comment

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

Missing default value for includeNoShowInRRCalculation parameter in getBookingsOfInterval function

@@ -29,6 +29,7 @@ const buildWhereClauseForActiveBookings = ({
endDate,
users,
virtualQueuesData,
includeNoShowInRRCalculation = false,
Copy link

Choose a reason for hiding this comment

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

Default value in function parameter doesn't match type definition

@@ -41,20 +42,18 @@
selectedOptionIds: string | number | string[];
};
} | null;
includeNoShowInRRCalculation: boolean;
Copy link

Choose a reason for hiding this comment

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

Required parameter follows optional parameters in function signature

@@ -291,6 +267,7 @@
startDate,
endDate,
virtualQueuesData,
includeNoShowInRRCalculation,
Copy link

Choose a reason for hiding this comment

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

Missing documentation for new parameter in getAllBookingsForRoundRobin

@@ -127,6 +127,7 @@ export const useEventTypeForm = ({
},
isRRWeightsEnabled: eventType.isRRWeightsEnabled,
maxLeadThreshold: eventType.maxLeadThreshold,
includeNoShowInRRCalculation: eventType.includeNoShowInRRCalculation,
Copy link

Choose a reason for hiding this comment

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

Rule violated: Enforce Singular Naming for Single-Item Functions

  Property name uses singular 'noShow' when referring to multiple no-show bookings

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 enterprise area: enterprise, audit log, organisation, SAML, SSO event-types area: event types, event-types ✨ feature New feature or request ❗️ migrations contains migration files ready-for-e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants