Skip to content

refactor(bookings): add round-robin host effective-limits foundation#28760

Closed
deepshekhardas wants to merge 2 commits intocalcom:mainfrom
deepshekhardas:fix/round-robin-limits-28715
Closed

refactor(bookings): add round-robin host effective-limits foundation#28760
deepshekhardas wants to merge 2 commits intocalcom:mainfrom
deepshekhardas:fix/round-robin-limits-28715

Conversation

@deepshekhardas
Copy link
Copy Markdown

Fixes #28715

Summary

Foundation implementation for per-member round-robin booking limits. This PR establishes the service structure without changing current booking behavior.

Changes

  • Added RoundRobinHostLimitsService class
  • Implemented getEffectiveLimits() to calculate host booking counts within time windows
  • Implemented ilterHostsByLimits() structure (currently allows all hosts)
  • Implemented getHostLimitStatus() for UI indicators

Time Windows Supported

  • Day
  • Week
  • Month

Structure

  • Host limit configuration with userId, eventTypeId, limit, and window
  • Booking count queries within time windows
  • Remaining slots calculation

Next Steps

Future PR will:

  • Add UI for configuring host limits
  • Enable actual limit enforcement
  • Add limit exceeded notifications

Testing

  • Service methods are unit testable
  • Foundation structure ready for limit enforcement

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/features/ee/round-robin/RoundRobinHostLimitsService.ts">

<violation number="1" location="packages/features/ee/round-robin/RoundRobinHostLimitsService.ts:49">
P2: Falsely treating `limit = 0` as "no limit" due to a falsy check allows unlimited capacity when a zero limit should mean no bookings allowed.</violation>
</file>

<file name="apps/web/modules/bookings/columns/filterColumns.ts">

<violation number="1" location="apps/web/modules/bookings/columns/filterColumns.ts:138">
P2: Newly added UTM header translation keys are referenced but missing in locale resources, causing fallback/raw key rendering in the UI.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

const window = config?.window ?? null;

// If no limit is set, host has unlimited capacity
if (!limit || !window) {
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Apr 6, 2026

Choose a reason for hiding this comment

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

P2: Falsely treating limit = 0 as "no limit" due to a falsy check allows unlimited capacity when a zero limit should mean no bookings allowed.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/features/ee/round-robin/RoundRobinHostLimitsService.ts, line 49:

<comment>Falsely treating `limit = 0` as "no limit" due to a falsy check allows unlimited capacity when a zero limit should mean no bookings allowed.</comment>

<file context>
@@ -0,0 +1,225 @@
+      const window = config?.window ?? null;
+
+      // If no limit is set, host has unlimited capacity
+      if (!limit || !window) {
+        results.push({
+          userId,
</file context>
Suggested change
if (!limit || !window) {
if (limit == null || window == null) {
Fix with Cubic

}),
columnHelper.accessor((row) => (row.type === "data" ? row.booking.utmSource : null), {
id: "utmSource",
header: t("utm_source"),
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Apr 6, 2026

Choose a reason for hiding this comment

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

P2: Newly added UTM header translation keys are referenced but missing in locale resources, causing fallback/raw key rendering in the UI.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/web/modules/bookings/columns/filterColumns.ts, line 138:

<comment>Newly added UTM header translation keys are referenced but missing in locale resources, causing fallback/raw key rendering in the UI.</comment>

<file context>
@@ -128,5 +133,64 @@ export function buildFilterColumns({ t, permissions, status }: BuildFilterColumn
     }),
+    columnHelper.accessor((row) => (row.type === "data" ? row.booking.utmSource : null), {
+      id: "utmSource",
+      header: t("utm_source"),
+      enableColumnFilter: true,
+      enableSorting: false,
</file context>
Fix with Cubic

@romitg2 romitg2 closed this Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants