feat: Round Robin timestamp basis (#21337)

* add rrTimeStampBasis to prisma schema

* add rr time stamp basis setting

* update migration

* add getLuckyUser logic

* add rrTimestampBasis to tests

* add load balancing warning message

* disable load balancing logic

* disable load balancing in event type settings

* add missing translations

* fix UI

* disable load balancing on all team event types

* don't show routing forms in router position

* use correct interval times

* fix variable naming

* fix event type update handler

* add test to booking.test.ts

* add test for getting interval times

* remove not needed prop

* fix label

* improve warning message

* fix removing maxLeadTreshold

* fix typo

* fix disabling maxLeadThreshold

* add back missing translation

* improve rr reset interval label

* fix rr_load_balancing_disabled text

* improve test

* fix description

* only use rrTimestampBasis in weights round robin

* fix dropdown width

---------

Co-authored-by: CarinaWolli <[email protected]>
This commit is contained in:
Carina WollendorferandCarinaWolli authored and GitHub committed 2025-06-12 11:37:38 +01:00
1 parent 84717ca73e
commit 6de715b884
62 files changed
+552 -215

No files matched your search

@@ -158,19 +158,19 @@ export class SlotsController_2024_04_15 {
@Req() req: ExpressRequest
): Promise<ApiResponse<{ slots: TimeSlots["slots"] | RangeSlots["slots"] }>> {
try {
const isTeamEvent =
query.isTeamEvent === undefined
? await this.slotsService.checkIfIsTeamEvent(query.eventTypeId)
: query.isTeamEvent;
const availableSlots = await getAvailableSlots({
input: {
...query,
isTeamEvent,
},
ctx: {
req,
},
});
const isTeamEvent =
query.isTeamEvent === undefined
? await this.slotsService.checkIfIsTeamEvent(query.eventTypeId)
: query.isTeamEvent;
const availableSlots = await getAvailableSlots({
input: {
...query,
isTeamEvent,
},
ctx: {
req,
},
});
const { slots } = await this.slotsOutputService.getOutputSlots(
availableSlots,
@@ -7,8 +7,8 @@ import type { CSSProperties, SyntheticEvent } from "react";
import React from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { EmailField } from "@calcom/ui/components/form";
import { Button } from "@calcom/ui/components/button";
import { EmailField } from "@calcom/ui/components/form";
import AuthContainer from "@components/ui/AuthContainer";
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "ليس لديك الصلاحية لإنشاء مؤسسة لهذا البريد الإلكتروني",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "ليس لديك الصلاحية لنقل فريق واحد أو أكثر",
"organization_has_subscription_already": "المؤسسة لديها اشتراك بالفعل",
"rr_reset_interval": "فترة إعادة تعيين الترتيب الدوري",
"interval": "الفترة",
"rr_reset_interval_description": "تحدد مدى تكرار إعادة تعيين عدد الحجوزات في الترتيب الدوري لضمان توزيع متوازن.",
"daily": "يوميًا",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Bu e-poçt üçün təşkilat yaratmağa icazəniz yoxdur",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Bir və ya bir neçə komandanı köçürməyə icazəniz yoxdur",
"organization_has_subscription_already": "Təşkilatın artıq abunəliyi var",
"rr_reset_interval": "Round Robin Sıfırlama İntervalı",
"interval": "İnterval",
"rr_reset_interval_description": "Tarazlı paylaşımı təmin etmək üçün round robin rezervasiya sayının nə qədər tez-tez sıfırlanacağını müəyyən edir.",
"daily": "Gündəlik",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Bu istifadəçilər arasında artıq əks yönləndirmə mövcuddur.",
"previous_ooo_empty_title": "Əvvəlki OOO tapılmadı",
"previous": "Əvvəlki",
"rr_interval_successfully_updated": "Round Robin intervalı uğurla yeniləndi",
"trial_mode": "Sınaq rejimi",
"inactive_team_plan": "Qeyri-aktiv komanda planı",
"inactive_team_plan_description": "Komanda planınız qeyri-aktivdir. Abunəliyinizi yoxlayın və ya müştəri dəstəyi ilə əlaqə saxlayın",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Нямате разрешение да създадете организация за този имейл",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Нямате разрешение да мигрирате един или повече от екипите",
"organization_has_subscription_already": "Организацията вече има абонамент",
"rr_reset_interval": "Интервал за нулиране на Round Robin",
"interval": "Интервал",
"rr_reset_interval_description": "Определя колко често се нулира броят на резервациите в round robin, за да се осигури балансирано разпределение.",
"daily": "Ежедневно",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Вече съществува обратно пренасочване между тези потребители.",
"previous_ooo_empty_title": "Не са намерени предишни OOO",
"previous": "Предишен",
"rr_interval_successfully_updated": "Интервалът на Round Robin е успешно актуализиран",
"trial_mode": "Пробен режим",
"inactive_team_plan": "Неактивен план за екип",
"inactive_team_plan_description": "Вашият план за екип е неактивен. Проверете абонамента си или се свържете с отдела за обслужване на клиенти",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "No teniu permís per crear una organització per a aquest correu electrònic",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "No teniu permís per migrar un o més dels equips",
"organization_has_subscription_already": "L'organització ja té una subscripció",
"rr_reset_interval": "Interval de reinici del Round Robin",
"interval": "Interval",
"rr_reset_interval_description": "Determina amb quina freqüència es reinicia el comptador de reserves del round robin per assegurar una distribució equilibrada.",
"daily": "Diàriament",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Ja hi ha una redirecció inversa entre aquests usuaris.",
"previous_ooo_empty_title": "No s'ha trobat cap OOO anterior",
"previous": "Anterior",
"rr_interval_successfully_updated": "L'interval del Round Robin s'ha actualitzat correctament",
"trial_mode": "Mode de prova",
"inactive_team_plan": "Pla d'equip inactiu",
"inactive_team_plan_description": "El teu pla d'equip està inactiu. Comprova la teva subscripció o contacta amb el suport al client",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Nemáte oprávnění vytvořit organizaci pro tento e-mail",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Nemáte oprávnění migrovat jeden nebo více týmů",
"organization_has_subscription_already": "Organizace již má předplatné",
"rr_reset_interval": "Interval resetování Round Robin",
"interval": "Interval",
"rr_reset_interval_description": "Určuje, jak často se resetuje počet rezervací v systému round robin pro zajištění vyváženého rozdělení.",
"daily": "Denně",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Mezi těmito uživateli již existuje zpětné přesměrování.",
"previous_ooo_empty_title": "Nenalezeno žádné předchozí OOO",
"previous": "Předchozí",
"rr_interval_successfully_updated": "Interval Round Robin byl úspěšně aktualizován",
"trial_mode": "Zkušební režim",
"inactive_team_plan": "Neaktivní týmový plán",
"inactive_team_plan_description": "Váš týmový plán je neaktivní. Zkontrolujte své předplatné nebo kontaktujte zákaznickou podporu",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Du har ikke tilladelse til at oprette en organisation for denne e-mail",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Du har ikke tilladelse til at migrere et eller flere af teamene",
"organization_has_subscription_already": "Organisationen har allerede et abonnement",
"rr_reset_interval": "Round Robin nulstillingsinterval",
"interval": "Interval",
"rr_reset_interval_description": "Bestemmer hvor ofte round robin-bookingtællingen nulstilles for at sikre en balanceret fordeling.",
"daily": "Dagligt",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Der er allerede en omvendt videresendelse mellem disse brugere.",
"previous_ooo_empty_title": "Ingen tidligere fravær fundet",
"previous": "Forrige",
"rr_interval_successfully_updated": "Round Robin-interval blev opdateret med succes",
"trial_mode": "Prøveperiode",
"inactive_team_plan": "Inaktiv teamplan",
"inactive_team_plan_description": "Din teamplan er inaktiv. Tjek dit abonnement eller kontakt kundesupport",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Sie haben keine berechtigung, eine organisation für diese e-mail-adresse zu erstellen",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Sie haben keine berechtigung, eines oder mehrere der teams zu migrieren",
"organization_has_subscription_already": "Die organisation hat bereits ein abonnement",
"rr_reset_interval": "Round Robin Zurücksetzungsintervall",
"interval": "Intervall",
"rr_reset_interval_description": "Legt fest, wie oft der Round Robin Buchungszähler zurückgesetzt wird, um eine ausgewogene Verteilung zu gewährleisten.",
"daily": "Täglich",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Es gibt bereits eine umgekehrte Weiterleitung zwischen diesen Benutzern.",
"previous_ooo_empty_title": "Keine vorherige Abwesenheit gefunden",
"previous": "Vorherige",
"rr_interval_successfully_updated": "Round Robin Intervall erfolgreich aktualisiert",
"trial_mode": "Testmodus",
"inactive_team_plan": "Inaktiver Team-Plan",
"inactive_team_plan_description": "Ihr Team-Plan ist inaktiv. Überprüfen Sie Ihr Abonnement oder wenden Sie sich an den Kundensupport",
@@ -3210,4 +3208,4 @@
"members_affected_by_disabling_delegation_credential": "Betroffene Mitglieder",
"no_members_affected_by_disabling_delegation_credential": "Keine Mitglieder von der Deaktivierung der Delegationsanmeldedaten betroffen",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Fügen Sie Ihre neuen Code-Zeilen über dieser hinzu ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Δεν έχετε άδεια να δημιουργήσετε οργανισμό για αυτό το email",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Δεν έχετε άδεια να μεταφέρετε μία ή περισσότερες από τις ομάδες",
"organization_has_subscription_already": "Ο οργανισμός έχει ήδη συνδρομή",
"rr_reset_interval": "Διάστημα επαναφοράς Round Robin",
"interval": "Διάστημα",
"rr_reset_interval_description": "Καθορίζει πόσο συχνά επαναφέρεται ο μετρητής κρατήσεων round robin για να διασφαλιστεί η ισορροπημένη κατανομή.",
"daily": "Καθημερινά",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Υπάρχει ήδη αντίστροφη προώθηση μεταξύ αυτών των χρηστών.",
"previous_ooo_empty_title": "Δεν βρέθηκαν προηγούμενες απουσίες",
"previous": "Προηγούμενο",
"rr_interval_successfully_updated": "Το διάστημα Round Robin ενημερώθηκε με επιτυχία",
"trial_mode": "Δοκιμαστική λειτουργία",
"inactive_team_plan": "Ανενεργό πλάνο ομάδας",
"inactive_team_plan_description": "Το πλάνο της ομάδας σας είναι ανενεργό. Ελέγξτε τη συνδρομή σας ή επικοινωνήστε με την εξυπηρέτηση πελατών",
+10 -1
View File
@@ -3064,7 +3064,7 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "You do not have permission to create an organization for this email",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "You do not have permission to migrate one or more of the teams",
"organization_has_subscription_already": "Organization has a subscription already",
"rr_reset_interval": "Round Robin Reset Interval",
"reset_interval_weighted_rr": "Reset interval for weighted Round Robin",
"interval": "Interval",
"rr_reset_interval_description": "Determines how often the round robin booking count resets to ensure balanced distribution.",
"daily": "Daily",
@@ -3227,9 +3227,18 @@
"matching": "Matching",
"event_redirect": "Event Redirect",
"reset_form": "Reset Form",
"rr_settings_successfully_updated": "Round Robin settings successfully updated",
"distribution_basis_weighted_rr": "Distribution basis for weighted Round Robin",
"timestamp_basis_description": "Determines which event timestamp is used as the basis for weighted round robin distribution.",
"requires_credits": "Requires credits",
"requires_credits_tooltip": "You need enough credits in your account to use this feature",
"available_credits": "Available credits",
"load_balancing_warning": "This will disable Load Balancing on all your Round Robin event types",
"rr_load_balancing_disabled": "Load Balancing is only available when the timestamp basis is set to Booking Creation Time",
"round_robin_settings_description": "Customize the default round robin settings for this team",
"round_robin_settings_updated_successfully": "Round Robin settings updated successfully",
"booking_creation_time": "Booking Creation Time",
"meeting_start_time": "Meeting Start Time",
"members_affected_by_disabling_delegation_credential": "Affected members",
"no_members_affected_by_disabling_delegation_credential": "No members affected by disabling delegation credential",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "No tienes permiso para crear una organización con este correo electrónico",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "No tienes permiso para migrar uno o más de los equipos",
"organization_has_subscription_already": "La organización ya tiene una suscripción",
"rr_reset_interval": "Intervalo de reinicio de Round Robin",
"interval": "Intervalo",
"rr_reset_interval_description": "Determina con qué frecuencia se reinicia el conteo de reservas de round robin para asegurar una distribución equilibrada.",
"daily": "Diario",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Ya existe un reenvío inverso entre estos usuarios.",
"previous_ooo_empty_title": "No se encontraron ausencias anteriores",
"previous": "Anterior",
"rr_interval_successfully_updated": "Intervalo de Round Robin actualizado exitosamente",
"trial_mode": "Modo de prueba",
"inactive_team_plan": "Plan de equipo inactivo",
"inactive_team_plan_description": "Tu plan de equipo está inactivo. Revisa tu suscripción o comunícate con el soporte al cliente",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "No tienes permiso para crear una organización con este correo electrónico",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "No tienes permiso para migrar uno o más de los equipos",
"organization_has_subscription_already": "La organización ya tiene una suscripción",
"rr_reset_interval": "Intervalo de reinicio de rotación",
"interval": "Intervalo",
"rr_reset_interval_description": "Determina con qué frecuencia se reinicia el conteo de reservas de rotación para asegurar una distribución equilibrada.",
"daily": "Diario",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Ya existe un reenvío inverso entre estos usuarios.",
"previous_ooo_empty_title": "No se encontraron ausencias anteriores",
"previous": "Anterior",
"rr_interval_successfully_updated": "Intervalo de rotación actualizado con éxito",
"trial_mode": "Modo de prueba",
"inactive_team_plan": "Plan de equipo inactivo",
"inactive_team_plan_description": "Tu plan de equipo está inactivo. Revisa tu suscripción o contacta con el soporte al cliente",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Teil pole luba selle e-posti aadressiga organisatsiooni loomiseks",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Teil pole luba ühe või mitme meeskonna migreerimiseks",
"organization_has_subscription_already": "Organisatsioonil on juba tellimus",
"rr_reset_interval": "Round Robini lähtestamise intervall",
"interval": "Intervall",
"rr_reset_interval_description": "Määrab, kui tihti round robini broneeringute arv lähtestatakse, et tagada tasakaalustatud jaotus.",
"daily": "Iga päev",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Nende kasutajate vahel on juba vastupidine edasisuunamine.",
"previous_ooo_empty_title": "Eelmist OOO-d ei leitud",
"previous": "Eelmine",
"rr_interval_successfully_updated": "Round Robini intervall edukalt uuendatud",
"trial_mode": "Prooviversioon",
"inactive_team_plan": "Mitteaktiivne meeskonnaplaan",
"inactive_team_plan_description": "Teie meeskonnaplaan on mitteaktiivne. Kontrollige oma tellimust või võtke ühendust klienditoega",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Ez duzu baimenik erakunde bat sortzeko helbide elektroniko honentzat",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Ez duzu baimenik talde bat edo gehiago migratzeko",
"organization_has_subscription_already": "Erakundeak dagoeneko harpidetza bat du",
"rr_reset_interval": "Round Robin berrezartzeko tartea",
"interval": "Tartea",
"rr_reset_interval_description": "Zehazten du zenbatero berrezartzen den round robin erreserben zenbaketa, banaketa orekatua ziurtatzeko.",
"daily": "Egunero",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Dagoeneko alderantzizko birbideratze bat dago erabiltzaile hauen artean.",
"previous_ooo_empty_title": "Ez da aurreko OOOrik aurkitu",
"previous": "Aurrekoa",
"rr_interval_successfully_updated": "Round Robin tartea arrakastaz eguneratu da",
"trial_mode": "Proba modua",
"inactive_team_plan": "Talde plan inaktiboa",
"inactive_team_plan_description": "Zure talde plana inaktiboa dago. Egiaztatu zure harpidetza edo jarri harremanetan bezeroen laguntzarekin",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Sinulla ei ole oikeutta luoda organisaatiota tälle sähköpostiosoitteelle",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Sinulla ei ole oikeutta siirtää yhtä tai useampaa tiimiä",
"organization_has_subscription_already": "Organisaatiolla on jo tilaus",
"rr_reset_interval": "Round Robin -nollausväli",
"interval": "Aikaväli",
"rr_reset_interval_description": "Määrittää, kuinka usein round robin -varauslaskuri nollataan tasapainoisen jakelun varmistamiseksi.",
"daily": "Päivittäin",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Näiden käyttäjien välillä on jo käänteinen uudelleenohjaus.",
"previous_ooo_empty_title": "Aiempia poissaoloja ei löytynyt",
"previous": "Edellinen",
"rr_interval_successfully_updated": "Round Robin -aikaväli päivitetty onnistuneesti",
"trial_mode": "Kokeilutila",
"inactive_team_plan": "Ei-aktiivinen tiimitilaus",
"inactive_team_plan_description": "Tiimitilauksesi ei ole aktiivinen. Tarkista tilauksesi tai ota yhteyttä asiakastukeen",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Vous n'avez pas la permission de créer une organisation pour cet e-mail",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Vous n'avez pas la permission de migrer une ou plusieurs des équipes",
"organization_has_subscription_already": "L'organisation a déjà un abonnement",
"rr_reset_interval": "Intervalle de réinitialisation du round-robin",
"interval": "Intervalle",
"rr_reset_interval_description": "Détermine la fréquence à laquelle le compteur de réservations round-robin se réinitialise pour assurer une distribution équilibrée.",
"daily": "Quotidien",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Il existe déjà une redirection inverse entre ces utilisateurs.",
"previous_ooo_empty_title": "Aucune absence précédente trouvée",
"previous": "Précédent",
"rr_interval_successfully_updated": "Intervalle round-robin mis à jour avec succès",
"trial_mode": "Mode d'essai",
"inactive_team_plan": "Plan d'équipe inactif",
"inactive_team_plan_description": "Votre plan d'équipe est inactif. Vérifiez votre abonnement ou contactez le support client",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "אין לך הרשאה ליצור ארגון עבור כתובת האימייל הזו",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "אין לך הרשאה להעביר אחד או יותר מהצוותים",
"organization_has_subscription_already": "לארגון כבר יש מנוי",
"rr_reset_interval": "מרווח איפוס סבב",
"interval": "מרווח",
"rr_reset_interval_description": "קובע באיזו תדירות מתאפס מונה ההזמנות בסבב כדי להבטיח חלוקה מאוזנת.",
"daily": "יומי",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "כבר קיימת הפניה הפוכה בין משתמשים אלה.",
"previous_ooo_empty_title": "לא נמצאו יציאות מהמשרד קודמות",
"previous": "קודם",
"rr_interval_successfully_updated": "מרווח הסבב עודכן בהצלחה",
"trial_mode": "מצב ניסיון",
"inactive_team_plan": "תוכנית צוות לא פעילה",
"inactive_team_plan_description": "תוכנית הצוות שלך אינה פעילה. בדוק את המנוי שלך או פנה לתמיכת הלקוחות",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Nincs jogosultsága szervezetet létrehozni ehhez az e-mail címhez",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Nincs jogosultsága egy vagy több csapat migrálásához",
"organization_has_subscription_already": "A szervezetnek már van előfizetése",
"rr_reset_interval": "Round Robin visszaállítási időköz",
"interval": "Időköz",
"rr_reset_interval_description": "Meghatározza, hogy milyen gyakran állítódik vissza a round robin foglalások számlálója a kiegyensúlyozott elosztás érdekében.",
"daily": "Naponta",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Már létezik fordított átirányítás ezen felhasználók között.",
"previous_ooo_empty_title": "Nem található korábbi Irodán Kívül",
"previous": "Előző",
"rr_interval_successfully_updated": "Round Robin időköz sikeresen frissítve",
"trial_mode": "Próba üzemmód",
"inactive_team_plan": "Inaktív csapat előfizetés",
"inactive_team_plan_description": "Az Ön csapat előfizetése inaktív. Ellenőrizze előfizetését vagy vegye fel a kapcsolatot az ügyfélszolgálattal",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Non hai il permesso di creare un'organizzazione per questa email",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Non hai il permesso di migrare uno o più team",
"organization_has_subscription_already": "L'organizzazione ha già un abbonamento",
"rr_reset_interval": "Intervallo di reset round robin",
"interval": "Intervallo",
"rr_reset_interval_description": "Determina la frequenza con cui il conteggio delle prenotazioni round robin viene azzerato per garantire una distribuzione equilibrata.",
"daily": "Giornaliero",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Esiste già un reindirizzamento inverso tra questi utenti.",
"previous_ooo_empty_title": "Nessuna assenza precedente trovata",
"previous": "Precedente",
"rr_interval_successfully_updated": "Intervallo round robin aggiornato con successo",
"trial_mode": "Modalità di prova",
"inactive_team_plan": "Piano team inattivo",
"inactive_team_plan_description": "Il tuo piano team è inattivo. Controlla il tuo abbonamento o contatta l'assistenza clienti",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "このメールアドレスで組織を作成する権限がありません",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "1つ以上のチームを移行する権限がありません",
"organization_has_subscription_already": "組織はすでにサブスクリプションを持っています",
"rr_reset_interval": "ラウンドロビンのリセット間隔",
"interval": "間隔",
"rr_reset_interval_description": "ラウンドロビンの予約カウントがリセットされる頻度を決定し、バランスの取れた配分を確保します。",
"daily": "毎日",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "これらのユーザー間にはすでに逆方向の転送が存在します。",
"previous_ooo_empty_title": "過去のOOOが見つかりません",
"previous": "前へ",
"rr_interval_successfully_updated": "ラウンドロビンの間隔が正常に更新されました",
"trial_mode": "トライアルモード",
"inactive_team_plan": "非アクティブなチームプラン",
"inactive_team_plan_description": "チームプランが非アクティブです。サブスクリプションを確認するか、カスタマーサポートにお問い合わせください",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "អ្នកមិនមានសិទ្ធិបង្កើតអង្គការសម្រាប់អ៊ីមែលនេះទេ",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "អ្នកមិនមានសិទ្ធិផ្លាស់ប្តូរក្រុមមួយឬច្រើនទេ",
"organization_has_subscription_already": "អង្គការមានការជាវជាប្រចាំរួចហើយ",
"rr_reset_interval": "ចន្លោះពេលកំណត់ឡើងវិញនៃ Round Robin",
"interval": "ចន្លោះពេល",
"rr_reset_interval_description": "កំណត់ថាតើញឹកញាប់ប៉ុណ្ណាដែលការរាប់ការកក់ round robin ត្រូវកំណត់ឡើងវិញដើម្បីធានាការចែកចាយស្មើគ្នា។",
"daily": "ប្រចាំថ្ងៃ",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "មានការបញ្ជូនបន្តត្រឡប់រវាងអ្នកប្រើប្រាស់ទាំងនេះរួចហើយ។",
"previous_ooo_empty_title": "រកមិនឃើញ OOO ពីមុនទេ",
"previous": "មុន",
"rr_interval_successfully_updated": "ចន្លោះពេល Round Robin ត្រូវបានធ្វើបច្ចុប្បន្នភាពដោយជោគជ័យ",
"trial_mode": "របៀបសាកល្បង",
"inactive_team_plan": "ផែនការក្រុមដែលមិនសកម្ម",
"inactive_team_plan_description": "ផែនការក្រុមរបស់អ្នកមិនសកម្មទេ។ សូមពិនិត្យមើលការជាវរបស់អ្នក ឬទាក់ទងសេវាកម្មអតិថិជន",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "이 이메일로 조직을 생성할 권한이 없습니다",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "하나 이상의 팀을 마이그레이션할 권한이 없습니다",
"organization_has_subscription_already": "조직이 이미 구독 중입니다",
"rr_reset_interval": "라운드 로빈 재설정 간격",
"interval": "간격",
"rr_reset_interval_description": "균형 잡힌 분배를 보장하기 위해 라운드 로빈 예약 횟수가 얼마나 자주 재설정되는지 결정합니다.",
"daily": "매일",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "이 사용자들 사이에 이미 역방향 전달이 설정되어 있습니다.",
"previous_ooo_empty_title": "이전 부재 기록 없음",
"previous": "이전",
"rr_interval_successfully_updated": "라운드 로빈 간격이 성공적으로 업데이트되었습니다",
"trial_mode": "체험 모드",
"inactive_team_plan": "비활성 팀 플랜",
"inactive_team_plan_description": "팀 플랜이 비활성 상태입니다. 구독을 확인하거나 고객 지원에 문의하세요",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Je hebt geen toestemming om een organisatie aan te maken voor dit e-mailadres",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Je hebt geen toestemming om een of meer teams te migreren",
"organization_has_subscription_already": "De organisatie heeft al een abonnement",
"rr_reset_interval": "Round Robin reset-interval",
"interval": "Interval",
"rr_reset_interval_description": "Bepaalt hoe vaak de round robin boekingstelling wordt gereset om een evenwichtige verdeling te garanderen.",
"daily": "Dagelijks",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Er is al een omgekeerde doorverwijzing tussen deze gebruikers.",
"previous_ooo_empty_title": "Geen eerdere OOO gevonden",
"previous": "Vorige",
"rr_interval_successfully_updated": "Round Robin-interval succesvol bijgewerkt",
"trial_mode": "Proefmodus",
"inactive_team_plan": "Inactief teamabonnement",
"inactive_team_plan_description": "Uw teamabonnement is inactief. Controleer uw abonnement of neem contact op met de klantenondersteuning",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Du har ikke tillatelse til å opprette en organisasjon for denne e-postadressen",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Du har ikke tillatelse til å migrere ett eller flere av teamene",
"organization_has_subscription_already": "Organisasjonen har allerede et abonnement",
"rr_reset_interval": "Round Robin tilbakestillingsintervall",
"interval": "Intervall",
"rr_reset_interval_description": "Bestemmer hvor ofte round robin-bookingtellingen tilbakestilles for å sikre balansert fordeling.",
"daily": "Daglig",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Det finnes allerede en omvendt videresending mellom disse brukerne.",
"previous_ooo_empty_title": "Ingen tidligere fravær funnet",
"previous": "Forrige",
"rr_interval_successfully_updated": "Round Robin-intervallet ble oppdatert",
"trial_mode": "Prøveperiode",
"inactive_team_plan": "Inaktiv teamplan",
"inactive_team_plan_description": "Din teamplan er inaktiv. Sjekk abonnementet ditt eller ta kontakt med kundeservice",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Nie masz uprawnień do utworzenia organizacji dla tego adresu e-mail",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Nie masz uprawnień do migracji jednego lub więcej zespołów",
"organization_has_subscription_already": "Organizacja ma już subskrypcję",
"rr_reset_interval": "Interwał resetowania Round Robin",
"interval": "Interwał",
"rr_reset_interval_description": "Określa, jak często resetuje się licznik rezerwacji Round Robin, aby zapewnić zrównoważony rozkład.",
"daily": "Codziennie",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Você não tem permissão para criar uma organização para este e-mail",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Você não tem permissão para migrar uma ou mais das equipes",
"organization_has_subscription_already": "A organização já possui uma assinatura",
"rr_reset_interval": "Intervalo de reinício do Round Robin",
"interval": "Intervalo",
"rr_reset_interval_description": "Determina com que frequência a contagem de reservas do round robin é reiniciada para garantir uma distribuição equilibrada.",
"daily": "Diariamente",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Já existe um encaminhamento reverso entre esses usuários.",
"previous_ooo_empty_title": "Nenhuma ausência anterior encontrada",
"previous": "Anterior",
"rr_interval_successfully_updated": "Intervalo do Round Robin atualizado com sucesso",
"trial_mode": "Modo de teste",
"inactive_team_plan": "Plano de equipe inativo",
"inactive_team_plan_description": "Seu plano de equipe está inativo. Verifique sua assinatura ou entre em contato com o suporte ao cliente",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Você não tem permissão para criar uma organização para este e-mail",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Você não tem permissão para migrar uma ou mais das equipes",
"organization_has_subscription_already": "A organização já possui uma assinatura",
"rr_reset_interval": "Intervalo de reinício do Round Robin",
"interval": "Intervalo",
"rr_reset_interval_description": "Determina com que frequência a contagem de reservas do round robin é reiniciada para garantir uma distribuição equilibrada.",
"daily": "Diariamente",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Já existe um encaminhamento reverso entre estes utilizadores.",
"previous_ooo_empty_title": "Nenhum fora do escritório anterior encontrado",
"previous": "Anterior",
"rr_interval_successfully_updated": "Intervalo do Round Robin atualizado com sucesso",
"trial_mode": "Modo de teste",
"inactive_team_plan": "Plano de equipa inativo",
"inactive_team_plan_description": "O seu plano de equipa está inativo. Verifique a sua subscrição ou contacte o apoio ao cliente",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Nu aveți permisiunea de a crea o organizație pentru acest email",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Nu aveți permisiunea de a migra una sau mai multe dintre echipe",
"organization_has_subscription_already": "Organizația are deja un abonament",
"rr_reset_interval": "Interval de resetare Round Robin",
"interval": "Interval",
"rr_reset_interval_description": "Determină cât de des se resetează numărul de rezervări round robin pentru a asigura o distribuție echilibrată.",
"daily": "Zilnic",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Există deja o redirecționare inversă între acești utilizatori.",
"previous_ooo_empty_title": "Nu s-a găsit niciun OOO anterior",
"previous": "Anterior",
"rr_interval_successfully_updated": "Intervalul Round Robin a fost actualizat cu succes",
"trial_mode": "Mod de probă",
"inactive_team_plan": "Plan de echipă inactiv",
"inactive_team_plan_description": "Planul dvs. de echipă este inactiv. Verificați-vă abonamentul sau contactați serviciul de asistență pentru clienți",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "У вас нет разрешения на создание организации для этого email",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "У вас нет разрешения на миграцию одной или нескольких команд",
"organization_has_subscription_already": "У организации уже есть подписка",
"rr_reset_interval": "Интервал сброса очередности",
"interval": "Интервал",
"rr_reset_interval_description": "Определяет, как часто сбрасывается счетчик бронирований по очереди для обеспечения равномерного распределения.",
"daily": "Ежедневно",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Между этими пользователями уже существует обратное перенаправление.",
"previous_ooo_empty_title": "Предыдущие статусы \"Вне офиса\" не найдены",
"previous": "Предыдущий",
"rr_interval_successfully_updated": "Интервал очередности успешно обновлен",
"trial_mode": "Пробный режим",
"inactive_team_plan": "Неактивный тарифный план команды",
"inactive_team_plan_description": "Ваш тарифный план команды неактивен. Проверьте вашу подписку или обратитесь в службу поддержки",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Nemáte oprávnenie vytvoriť organizáciu pre tento e-mail",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Nemáte oprávnenie migrovať jeden alebo viac tímov",
"organization_has_subscription_already": "Organizácia už má predplatné",
"rr_reset_interval": "Interval resetovania Round Robin",
"interval": "Interval",
"rr_reset_interval_description": "Určuje, ako často sa resetuje počet rezervácií v systéme round robin, aby sa zabezpečila vyvážená distribúcia.",
"daily": "Denne",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Medzi týmito používateľmi už existuje spätné presmerovanie.",
"previous_ooo_empty_title": "Nenašla sa žiadna predchádzajúca neprítomnosť",
"previous": "Predchádzajúce",
"rr_interval_successfully_updated": "Interval Round Robin bol úspešne aktualizovaný",
"trial_mode": "Skúšobný režim",
"inactive_team_plan": "Neaktívny tímový plán",
"inactive_team_plan_description": "Váš tímový plán je neaktívny. Skontrolujte svoje predplatné alebo kontaktujte zákaznícku podporu",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Nemate dozvolu da kreirate organizaciju za ovu e-poštu",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Nemate dozvolu da migrirate jedan ili više timova",
"organization_has_subscription_already": "Organizacija već ima pretplatu",
"rr_reset_interval": "Interval resetovanja kružnog dodeljivanja",
"interval": "Interval",
"rr_reset_interval_description": "Određuje koliko često se resetuje brojač kružnog dodeljivanja kako bi se osigurala uravnotežena distribucija.",
"daily": "Dnevno",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Već postoji obrnuto preusmeravanje između ovih korisnika.",
"previous_ooo_empty_title": "Nije pronađeno prethodno OOO",
"previous": "Prethodno",
"rr_interval_successfully_updated": "Interval kružnog dodeljivanja je uspešno ažuriran",
"trial_mode": "Probni režim",
"inactive_team_plan": "Neaktivan timski plan",
"inactive_team_plan_description": "Vaš timski plan je neaktivan. Proverite vašu pretplatu ili se obratite korisničkoj podršci",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Du har inte behörighet att skapa en organisation för denna e-postadress",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Du har inte behörighet att migrera ett eller flera av teamen",
"organization_has_subscription_already": "Organisationen har redan en prenumeration",
"rr_reset_interval": "Återställningsintervall för Round Robin",
"interval": "Intervall",
"rr_reset_interval_description": "Bestämmer hur ofta bokningsräknaren för Round Robin återställs för att säkerställa en balanserad fördelning.",
"daily": "Dagligen",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Det finns redan en omvänd vidarebefordran mellan dessa användare.",
"previous_ooo_empty_title": "Ingen tidigare frånvaro hittad",
"previous": "Föregående",
"rr_interval_successfully_updated": "Round Robin-intervallet har uppdaterats framgångsrikt",
"trial_mode": "Provperiod",
"inactive_team_plan": "Inaktiv teamplan",
"inactive_team_plan_description": "Din teamplan är inaktiv. Kontrollera din prenumeration eller kontakta kundsupport",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Bu e-posta için bir organizasyon oluşturma izniniz yok",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Bir veya daha fazla takımı taşıma izniniz yok",
"organization_has_subscription_already": "Organizasyonun zaten bir aboneliği var",
"rr_reset_interval": "Round Robin Sıfırlama Aralığı",
"interval": "Aralık",
"rr_reset_interval_description": "Round robin rezervasyon sayısının dengeli dağılımı sağlamak için ne sıklıkta sıfırlanacağını belirler.",
"daily": "Günlük",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "У вас немає дозволу створити організацію для цієї електронної адреси",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "У вас немає дозволу на міграцію однієї або кількох команд",
"organization_has_subscription_already": "Організація вже має підписку",
"rr_reset_interval": "Інтервал скидання ротації",
"interval": "Інтервал",
"rr_reset_interval_description": "Визначає, як часто скидається лічильник бронювань ротації для забезпечення збалансованого розподілу.",
"daily": "Щоденно",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Між цими користувачами вже існує зворотне перенаправлення.",
"previous_ooo_empty_title": "Попередніх режимів \"Поза офісом\" не знайдено",
"previous": "Попередній",
"rr_interval_successfully_updated": "Інтервал ротації успішно оновлено",
"trial_mode": "Пробний режим",
"inactive_team_plan": "Неактивний план команди",
"inactive_team_plan_description": "Ваш командний план неактивний. Перевірте вашу підписку або зверніться до служби підтримки",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "Bạn không có quyền tạo tổ chức cho email này",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "Bạn không có quyền di chuyển một hoặc nhiều nhóm",
"organization_has_subscription_already": "Tổ chức đã có đăng ký",
"rr_reset_interval": "Khoảng thời gian đặt lại Round Robin",
"interval": "Khoảng thời gian",
"rr_reset_interval_description": "Xác định tần suất đặt lại số lượng đặt lịch round robin để đảm bảo phân phối cân bằng.",
"daily": "Hàng ngày",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "Đã có một chuyển tiếp ngược lại giữa những người dùng này.",
"previous_ooo_empty_title": "Không tìm thấy OOO trước đó",
"previous": "Trước",
"rr_interval_successfully_updated": "Khoảng thời gian Round Robin đã được cập nhật thành công",
"trial_mode": "Chế độ dùng thử",
"inactive_team_plan": "Gói nhóm không hoạt động",
"inactive_team_plan_description": "Gói nhóm của bạn đang không hoạt động. Kiểm tra đăng ký của bạn hoặc liên hệ với bộ phận hỗ trợ khách hàng",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "您没有权限为此电子邮件创建组织",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "您没有权限迁移一个或多个团队",
"organization_has_subscription_already": "组织已有订阅",
"rr_reset_interval": "轮流模式重置间隔",
"interval": "间隔",
"rr_reset_interval_description": "决定轮流预订计数重置的频率,以确保均衡分配。",
"daily": "每日",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "这些用户之间已经存在反向转发。",
"previous_ooo_empty_title": "未找到以前的OOO",
"previous": "上一个",
"rr_interval_successfully_updated": "轮流模式间隔已成功更新",
"trial_mode": "试用模式",
"inactive_team_plan": "非活跃团队计划",
"inactive_team_plan_description": "您的团队计划处于非活跃状态。请检查您的订阅或联系客户支持",
@@ -3043,7 +3043,6 @@
"you_do_not_have_permission_to_create_an_organization_for_this_email": "您沒有權限為此電子郵件地址創建組織",
"you_do_not_have_permission_to_migrate_one_or_more_of_the_teams": "您沒有權限遷移一個或多個團隊",
"organization_has_subscription_already": "該組織已有訂閱",
"rr_reset_interval": "輪流制重置間隔",
"interval": "間隔",
"rr_reset_interval_description": "決定輪流制預約計數重置的頻率,以確保均衡分配。",
"daily": "每日",
@@ -3060,7 +3059,6 @@
"ooo_team_redirect_infinite_not_allowed": "這些用戶之間已經存在反向轉發。",
"previous_ooo_empty_title": "找不到先前的外出辦公記錄",
"previous": "上一個",
"rr_interval_successfully_updated": "輪流制間隔已成功更新",
"trial_mode": "試用模式",
"inactive_team_plan": "未啟用的團隊方案",
"inactive_team_plan_description": "您的團隊方案未啟用。請檢查您的訂閱或聯繫客戶支援",
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
import { z } from "zod";
import type { z } from "zod";
import { useBookerStore } from "@calcom/features/bookings/Booker/store";
import type getBookingResponsesSchema from "@calcom/features/bookings/lib/getBookingResponsesSchema";
@@ -836,6 +836,7 @@ async function handler(
).filter((host) => !host.isFixed && userIdsSet.has(host.user.id)),
eventType,
routingFormResponse,
meetingStartTime: new Date(reqBody.start),
});
if (!newLuckyUser) {
break; // prevent infinite loop
@@ -44,6 +44,7 @@ export const getEventTypesFromDB = async (eventTypeId: number) => {
bookingLimits: true,
includeManagedEventsInLimits: true,
rrResetInterval: true,
rrTimestampBasis: true,
},
},
bookingFields: true,
@@ -187,7 +187,8 @@ export default async function handleChildrenEventTypes({
rrSegmentQueryValue: undefined,
assignRRMembersUsingSegment: false,
useEventLevelSelectedCalendars: false,
allowReschedulingCancelledBookings: managedEventTypeValues.allowReschedulingCancelledBookings ?? false,
allowReschedulingCancelledBookings:
managedEventTypeValues.allowReschedulingCancelledBookings ?? false,
},
});
})
@@ -260,7 +261,8 @@ export default async function handleChildrenEventTypes({
: {
deleteMany: {},
},
allowReschedulingCancelledBookings: managedEventTypeValues.allowReschedulingCancelledBookings ?? false,
allowReschedulingCancelledBookings:
managedEventTypeValues.allowReschedulingCancelledBookings ?? false,
metadata: {
...(eventType.metadata as Prisma.JsonObject),
...(metadata?.multipleDuration && "length" in unlockedFieldProps
@@ -1,26 +1,13 @@
"use client";
import { useForm, Controller } from "react-hook-form";
import { Controller } from "react-hook-form";
import { checkAdminOrOwner } from "@calcom/features/auth/lib/checkAdminOrOwner";
import SectionBottomActions from "@calcom/features/settings/SectionBottomActions";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { RRResetInterval } from "@calcom/prisma/enums";
import { trpc } from "@calcom/trpc/react";
import type { RouterOutputs } from "@calcom/trpc/react";
import { Button } from "@calcom/ui/components/button";
import { Label } from "@calcom/ui/components/form";
import { Select } from "@calcom/ui/components/form";
import { Form } from "@calcom/ui/components/form";
import { showToast } from "@calcom/ui/components/toast";
interface ProfileViewProps {
team: RouterOutputs["viewer"]["teams"]["get"];
}
const RoundRobinResetInterval = ({ team }: ProfileViewProps) => {
const RoundRobinResetInterval = () => {
const { t } = useLocale();
const utils = trpc.useUtils();
const intervalOptions: {
value: RRResetInterval;
@@ -36,69 +23,31 @@ const RoundRobinResetInterval = ({ team }: ProfileViewProps) => {
},
];
const form = useForm<{ rrResetInterval: RRResetInterval }>({
defaultValues: {
rrResetInterval: team?.rrResetInterval ?? RRResetInterval.MONTH,
},
});
const mutation = trpc.viewer.teams.update.useMutation({
onError: (err) => {
showToast(err.message, "error");
},
async onSuccess(res) {
await utils.viewer.teams.get.invalidate();
showToast(t("rr_interval_successfully_updated"), "success");
},
});
const isAdmin = team && checkAdminOrOwner(team.membership.role);
if (!isAdmin) {
return (
<div className="border-subtle rounded-md border p-5">
<span className="text-default text-sm">{t("only_owner_change")}</span>
</div>
);
}
return (
<Form
form={form}
handleSubmit={(values) => {
mutation.mutate({ ...values, id: team.id });
}}>
<Controller
name="rrResetInterval"
render={({ field: { value, onChange } }) => {
return (
<div className="border-subtle mt-6 space-x-3 rounded-t-lg border border-b-0 px-4 py-6 sm:px-6">
<div>
<h4 className="text-emphasis text-sm font-semibold leading-5">{t("rr_reset_interval")}</h4>
<p className="text-default text-sm leading-tight">{t("rr_reset_interval_description")}</p>
<div className="-mx-4 mt-4 border-t sm:-mx-6">
<div className="px-4 pt-6 sm:px-6">
<Label>{t("interval")}</Label>
<Select
options={intervalOptions}
value={intervalOptions.find((opt) => opt.value === value)}
onChange={(val) => {
onChange(val?.value);
}}
/>
</div>
</div>
<Controller
name="rrResetInterval"
render={({ field: { value, onChange } }) => {
return (
<>
<div className="">
<h4 className="text-emphasis text-sm font-semibold leading-5">
{t("reset_interval_weighted_rr")}
</h4>
<p className="text-default text-sm">{t("rr_reset_interval_description")}</p>
<div className="mt-4 w-48">
<Select
options={intervalOptions}
value={intervalOptions.find((opt) => opt.value === value)}
onChange={(val) => {
onChange(val?.value);
}}
/>
</div>
</div>
);
}}
/>
<SectionBottomActions align="end">
<Button type="submit" color="primary" loading={mutation.isPending}>
{t("update")}
</Button>
</SectionBottomActions>
</Form>
</>
);
}}
/>
);
};
@@ -0,0 +1,88 @@
"use client";
import { useForm } from "react-hook-form";
import { checkAdminOrOwner } from "@calcom/features/auth/lib/checkAdminOrOwner";
import SectionBottomActions from "@calcom/features/settings/SectionBottomActions";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { RRResetInterval, RRTimestampBasis } from "@calcom/prisma/client";
import type { RouterOutputs } from "@calcom/trpc/react";
import { trpc } from "@calcom/trpc/react";
import { Button } from "@calcom/ui/components/button";
import { Form } from "@calcom/ui/components/form";
import { showToast } from "@calcom/ui/components/toast";
import RoundRobinResetInterval from "./RoundRobinResetInterval";
import RoundRobinTimestampBasis from "./RoundRobinTimestampBasis";
interface RoundRobinSettingsProps {
team: RouterOutputs["viewer"]["teams"]["get"];
}
const RoundRobinSettings = ({ team }: RoundRobinSettingsProps) => {
const { t } = useLocale();
const isAdmin = team && checkAdminOrOwner(team.membership.role);
const rrResetInterval = team?.rrResetInterval ?? undefined;
const utils = trpc.useUtils();
const form = useForm<{ rrResetInterval: RRResetInterval; rrTimestampBasis: RRTimestampBasis }>({
defaultValues: {
rrResetInterval: rrResetInterval ?? RRResetInterval.MONTH,
rrTimestampBasis: team?.rrTimestampBasis ?? RRTimestampBasis.CREATED_AT,
},
});
const mutation = trpc.viewer.teams.update.useMutation({
onError: (err) => {
showToast(err.message, "error");
},
async onSuccess() {
await utils.viewer.teams.get.invalidate();
showToast(t("round_robin_settings_updated_successfully"), "success");
},
});
if (!isAdmin) {
return (
<div className="border-subtle rounded-md border p-5">
<span className="text-default text-sm">{t("only_owner_change")}</span>
</div>
);
}
return (
<Form
form={form}
handleSubmit={(values) => {
mutation.mutate({
id: team.id,
rrResetInterval: values.rrResetInterval,
rrTimestampBasis: values.rrTimestampBasis,
});
}}>
<div className="border-subtle mt-6 space-x-3 rounded-t-lg border border-b-0 px-4 py-6 pb-0 sm:px-6">
{" "}
<div>
<h4 className="text-emphasis text-sm font-semibold leading-5">{t("round_robin")}</h4>
<p className="text-default text-sm leading-tight">{t("round_robin_settings_description")}</p>
<div className="-mx-4 mt-4 sm:-mx-6">
<div className="border-subtle border-t px-6 py-6">
<RoundRobinResetInterval />
</div>
<div className="border-subtle border-t" />
<div className="border-subtle px-6 py-6">
<RoundRobinTimestampBasis />
</div>
</div>
</div>
</div>
<SectionBottomActions align="end">
<Button type="submit" color="primary" loading={mutation.isPending}>
{t("update")}
</Button>
</SectionBottomActions>
</Form>
);
};
export default RoundRobinSettings;
@@ -0,0 +1,55 @@
"use client";
import { Controller } from "react-hook-form";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { RRTimestampBasis } from "@calcom/prisma/enums";
import { Select } from "@calcom/ui/components/form";
const RoundRobinTimestampBasis = () => {
const { t } = useLocale();
const timestampBasisOptions: {
value: RRTimestampBasis;
label: string;
}[] = [
{
value: RRTimestampBasis.CREATED_AT,
label: t("booking_creation_time"),
},
{
value: RRTimestampBasis.START_TIME,
label: t("meeting_start_time"),
},
];
return (
<Controller
name="rrTimestampBasis"
render={({ field: { value, onChange } }) => {
return (
<>
<h4 className="text-emphasis text-sm font-semibold leading-5">
{t("distribution_basis_weighted_rr")}
</h4>
<p className="text-default text-sm leading-tight">{t("timestamp_basis_description")}</p>
<div className="mt-4 w-52">
<Select
options={timestampBasisOptions}
value={timestampBasisOptions.find((opt) => opt.value === value)}
onChange={(val) => {
onChange(val?.value);
}}
/>
</div>
{value !== RRTimestampBasis.CREATED_AT && (
<p className="text-attention mt-2 text-sm">{t("load_balancing_warning")}</p>
)}
</>
);
}}
/>
);
};
export default RoundRobinTimestampBasis;
@@ -25,7 +25,7 @@ import { showToast } from "@calcom/ui/components/toast";
import DisableTeamImpersonation from "../components/DisableTeamImpersonation";
import { default as InternalNotePresetsView } from "../components/InternalNotePresetsView";
import MakeTeamPrivateSwitch from "../components/MakeTeamPrivateSwitch";
import RoundRobinResetInterval from "../components/RoundRobinResetInterval";
import RoundRobinSettings from "../components/RoundRobinSettings";
type ProfileViewProps = { team: RouterOutputs["viewer"]["teams"]["get"] };
@@ -210,7 +210,7 @@ const TeamSettingsViewWrapper = () => {
<BookingLimitsView team={team} />
<PrivacySettingsView team={team} />
<InternalNotePresetsView team={team} />
<RoundRobinResetInterval team={team} />
<RoundRobinSettings team={team} />
</>
);
};
@@ -23,12 +23,13 @@ import type {
} from "@calcom/features/eventtypes/lib/types";
import ServerTrans from "@calcom/lib/components/ServerTrans";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { SchedulingType } from "@calcom/prisma/enums";
import { RRTimestampBasis, SchedulingType } from "@calcom/prisma/enums";
import classNames from "@calcom/ui/classNames";
import { Label } from "@calcom/ui/components/form";
import { Select } from "@calcom/ui/components/form";
import { SettingsToggle } from "@calcom/ui/components/form";
import { RadioAreaGroup as RadioArea } from "@calcom/ui/components/radio";
import { Tooltip } from "@calcom/ui/components/tooltip";
import { EditWeightsForAllTeamMembers } from "../../EditWeightsForAllTeamMembers";
import WeightDescription from "../../WeightDescription";
@@ -715,14 +716,35 @@ export const EventTeamAssignmentTab = ({
</strong>
<p>{t("rr_distribution_method_availability_description")}</p>
</RadioArea.Item>
<RadioArea.Item
value="loadBalancing"
checked={value !== null}
className="text-sm"
classNames={{ container: "w-full" }}>
<strong className="mb-1 block">{t("rr_distribution_method_balanced_title")}</strong>
<p>{t("rr_distribution_method_balanced_description")}</p>
</RadioArea.Item>
{!!(
eventType.team?.rrTimestampBasis &&
eventType.team?.rrTimestampBasis !== RRTimestampBasis.CREATED_AT
) ? (
<Tooltip content={t("rr_load_balancing_disabled")}>
<div className="w-full">
<RadioArea.Item
value="loadBalancing"
checked={value !== null}
className="text-sm"
disabled={true}
classNames={{ container: "w-full" }}>
<strong className="mb-1">{t("rr_distribution_method_balanced_title")}</strong>
<p>{t("rr_distribution_method_balanced_description")}</p>
</RadioArea.Item>
</div>
</Tooltip>
) : (
<div className="w-full">
<RadioArea.Item
value="loadBalancing"
checked={value !== null}
className="text-sm"
classNames={{ container: "w-full" }}>
<strong className="mb-1">{t("rr_distribution_method_balanced_title")}</strong>
<p>{t("rr_distribution_method_balanced_description")}</p>
</RadioArea.Item>
</div>
)}
</RadioArea.Group>
)}
/>
@@ -73,6 +73,7 @@ class VirtualQueuesInsights {
AND m.role = 'ADMIN'
)
)
AND (t."rrTimestampBasis" IS NULL OR t."rrTimestampBasis" = 'CREATED_AT')
`;
// Convert the raw forms to serializable format
@@ -1,5 +1,6 @@
import logger from "@calcom/lib/logger";
import type { RRResetInterval, SelectedCalendar } from "@calcom/prisma/client";
import { RRTimestampBasis } from "@calcom/prisma/enums";
import type { CredentialForCalendarService } from "@calcom/types/Credential";
import type { RoutingFormResponse } from "../server/getLuckyUser";
@@ -97,6 +98,7 @@ export const filterHostsByLeadThreshold = async <T extends BaseHost<BaseUser>>({
team: {
parentId?: number | null;
rrResetInterval: RRResetInterval | null;
rrTimestampBasis: RRTimestampBasis;
} | null;
includeNoShowInRRCalculation: boolean;
};
@@ -105,7 +107,11 @@ export const filterHostsByLeadThreshold = async <T extends BaseHost<BaseUser>>({
if (maxLeadThreshold === 0) {
throw new Error(errorCodes.MAX_LEAD_THRESHOLD_FALSY);
}
if (maxLeadThreshold === null || hosts.length < 1) {
if (
maxLeadThreshold === null ||
hosts.length < 1 ||
(eventType.team?.rrTimestampBasis && eventType.team.rrTimestampBasis !== RRTimestampBasis.CREATED_AT)
) {
return hosts; // don't apply filter.
}
+7 -1
View File
@@ -3,6 +3,7 @@ import { findTeamMembersMatchingAttributeLogic } from "@calcom/lib/raqb/findTeam
import type { AttributesQueryValue } from "@calcom/lib/raqb/types";
import { safeStringify } from "@calcom/lib/safeStringify";
import type { RRResetInterval } from "@calcom/prisma/client";
import type { RRTimestampBasis } from "@calcom/prisma/enums";
import { SchedulingType } from "@calcom/prisma/enums";
import type { CredentialPayload } from "@calcom/types/Credential";
@@ -81,7 +82,12 @@ export type EventType = {
assignAllTeamMembers: boolean;
assignRRMembersUsingSegment: boolean;
rrSegmentQueryValue: AttributesQueryValue | null | undefined;
team: { id: number; parentId: number | null; rrResetInterval: RRResetInterval | null } | null;
team: {
id: number;
parentId: number | null;
rrResetInterval: RRResetInterval | null;
rrTimestampBasis: RRTimestampBasis;
} | null;
};
export function getNormalizedHosts<User extends BaseUser, Host extends BaseHost<User>>({
+1
View File
@@ -130,6 +130,7 @@ const commons = {
includeNoShowInRRCalculation: false,
useEventLevelSelectedCalendars: false,
rrResetInterval: null,
rrTimestampBasis: null,
interfaceLanguage: null,
customReplyToEmail: null,
};
+92 -14
View File
@@ -6,9 +6,14 @@ import { expect, it, describe, vi, beforeAll } from "vitest";
import dayjs from "@calcom/dayjs";
import { buildUser, buildBooking } from "@calcom/lib/test/builder";
import { AttributeType, RRResetInterval } from "@calcom/prisma/enums";
import { AttributeType, RRResetInterval, RRTimestampBasis } from "@calcom/prisma/enums";
import { getLuckyUser, prepareQueuesAndAttributesData } from "./getLuckyUser";
import {
getLuckyUser,
prepareQueuesAndAttributesData,
getIntervalStartDate,
getIntervalEndDate,
} from "./getLuckyUser";
type NonEmptyArray<T> = [T, ...T[]];
type GetLuckyUserAvailableUsersType = NonEmptyArray<ReturnType<typeof buildUser>>;
@@ -64,7 +69,7 @@ it("can find lucky user with maximize availability", async () => {
eventType: {
id: 1,
isRRWeightsEnabled: false,
team: { rrResetInterval: RRResetInterval.MONTH },
team: { rrResetInterval: RRResetInterval.MONTH, rrTimestampBasis: RRTimestampBasis.CREATED_AT },
},
allRRHosts: [],
routingFormResponse: null,
@@ -117,7 +122,10 @@ it("can find lucky user with maximize availability and priority ranking", async
eventType: {
id: 1,
isRRWeightsEnabled: false,
team: { rrResetInterval: RRResetInterval.MONTH },
team: {
rrResetInterval: RRResetInterval.MONTH,
team: { rrResetInterval: RRResetInterval.MONTH, rrTimestampBasis: RRTimestampBasis.CREATED_AT },
},
},
allRRHosts: [],
routingFormResponse: null,
@@ -174,7 +182,7 @@ it("can find lucky user with maximize availability and priority ranking", async
eventType: {
id: 1,
isRRWeightsEnabled: false,
team: { rrResetInterval: RRResetInterval.MONTH },
team: { rrResetInterval: RRResetInterval.MONTH, rrTimestampBasis: RRTimestampBasis.CREATED_AT },
},
allRRHosts: [],
routingFormResponse: null,
@@ -236,7 +244,7 @@ it("can find lucky user with maximize availability and priority ranking", async
eventType: {
id: 1,
isRRWeightsEnabled: false,
team: { rrResetInterval: RRResetInterval.MONTH },
team: { rrResetInterval: RRResetInterval.MONTH, rrTimestampBasis: RRTimestampBasis.CREATED_AT },
},
allRRHosts: [],
routingFormResponse: null,
@@ -327,7 +335,7 @@ describe("maximize availability and weights", () => {
eventType: {
id: 1,
isRRWeightsEnabled: true,
team: { rrResetInterval: RRResetInterval.MONTH },
team: { rrResetInterval: RRResetInterval.MONTH, rrTimestampBasis: RRTimestampBasis.CREATED_AT },
},
allRRHosts,
routingFormResponse: null,
@@ -435,7 +443,7 @@ describe("maximize availability and weights", () => {
eventType: {
id: 1,
isRRWeightsEnabled: true,
team: { rrResetInterval: RRResetInterval.DAY },
team: { rrResetInterval: RRResetInterval.DAY, rrTimestampBasis: RRTimestampBasis.CREATED_AT },
},
allRRHosts,
routingFormResponse: null,
@@ -543,7 +551,7 @@ describe("maximize availability and weights", () => {
eventType: {
id: 1,
isRRWeightsEnabled: true,
team: { rrResetInterval: RRResetInterval.DAY },
team: { rrResetInterval: RRResetInterval.DAY, rrTimestampBasis: RRTimestampBasis.CREATED_AT },
},
allRRHosts,
routingFormResponse: null,
@@ -638,7 +646,7 @@ describe("maximize availability and weights", () => {
eventType: {
id: 1,
isRRWeightsEnabled: true,
team: { rrResetInterval: RRResetInterval.MONTH },
team: { rrResetInterval: RRResetInterval.MONTH, rrTimestampBasis: RRTimestampBasis.CREATED_AT },
},
allRRHosts,
routingFormResponse: null,
@@ -745,7 +753,7 @@ describe("maximize availability and weights", () => {
eventType: {
id: 1,
isRRWeightsEnabled: true,
team: { rrResetInterval: RRResetInterval.MONTH },
team: { rrResetInterval: RRResetInterval.MONTH, rrTimestampBasis: RRTimestampBasis.CREATED_AT },
},
allRRHosts,
routingFormResponse: null,
@@ -840,7 +848,7 @@ describe("maximize availability and weights", () => {
eventType: {
id: 1,
isRRWeightsEnabled: true,
team: { rrResetInterval: RRResetInterval.MONTH },
team: { rrResetInterval: RRResetInterval.MONTH, rrTimestampBasis: RRTimestampBasis.CREATED_AT },
},
allRRHosts,
routingFormResponse: null,
@@ -865,7 +873,7 @@ describe("maximize availability and weights", () => {
eventType: {
id: 1,
isRRWeightsEnabled: true,
team: { rrResetInterval: RRResetInterval.MONTH },
team: { rrResetInterval: RRResetInterval.MONTH, rrTimestampBasis: RRTimestampBasis.CREATED_AT },
},
allRRHosts,
routingFormResponse: null,
@@ -1383,7 +1391,11 @@ describe("attribute weights and virtual queues", () => {
eventType: {
id: 1,
isRRWeightsEnabled: true,
team: { parentId: 1, rrResetInterval: RRResetInterval.DAY },
team: {
parentId: 1,
rrResetInterval: RRResetInterval.DAY,
rrTimestampBasis: RRTimestampBasis.CREATED_AT,
},
},
allRRHosts,
routingFormResponse,
@@ -1401,3 +1413,69 @@ describe("attribute weights and virtual queues", () => {
);
});
});
describe("get interval times", () => {
it("should get correct interval start time with meeting started timestamp basis and DAY interval", () => {
const meetingStartTime = new Date("2024-03-15T14:30:00Z");
const result = getIntervalStartDate({
interval: RRResetInterval.DAY,
rrTimestampBasis: RRTimestampBasis.START_TIME,
meetingStartTime,
});
expect(result).toEqual(new Date("2024-03-15T00:00:00Z"));
});
it("should get correct interval start time with meeting started timestamp basis and MONTH interval", () => {
const meetingStartTime = new Date("2024-03-15T14:30:00Z");
const result = getIntervalStartDate({
interval: RRResetInterval.MONTH,
rrTimestampBasis: RRTimestampBasis.START_TIME,
meetingStartTime,
});
expect(result).toEqual(new Date("2024-03-01T00:00:00Z"));
});
it("should get correct interval start time with created at timestamp basis and DAY interval", () => {
const result = getIntervalStartDate({
interval: RRResetInterval.DAY,
rrTimestampBasis: RRTimestampBasis.CREATED_AT,
});
expect(result).toEqual(new Date("2021-06-20T00:00:00Z")); // Based on the mocked system time
});
it("should get correct interval start time with created at timestamp basis and MONTH interval", () => {
const result = getIntervalStartDate({
interval: RRResetInterval.MONTH,
rrTimestampBasis: RRTimestampBasis.CREATED_AT,
});
expect(result).toEqual(new Date("2021-06-01T00:00:00Z")); // Based on the mocked system time
});
it("should get correct interval end time with meeting started timestamp basis and DAY interval", () => {
const meetingStartTime = new Date("2024-03-15T14:30:00Z");
const result = getIntervalEndDate({
interval: RRResetInterval.DAY,
rrTimestampBasis: RRTimestampBasis.START_TIME,
meetingStartTime,
});
expect(result).toEqual(new Date("2024-03-15T23:59:59.999Z"));
});
it("should get correct interval end time with meeting started timestamp basis and MONTH interval", () => {
const meetingStartTime = new Date("2024-03-15T14:30:00Z");
const result = getIntervalEndDate({
interval: RRResetInterval.MONTH,
rrTimestampBasis: RRTimestampBasis.START_TIME,
meetingStartTime,
});
expect(result).toEqual(new Date("2024-03-31T23:59:59.999Z"));
});
it("should get correct interval end time with created at timestamp basis", () => {
const result = getIntervalEndDate({
interval: RRResetInterval.DAY,
rrTimestampBasis: RRTimestampBasis.CREATED_AT,
});
expect(result).toEqual(new Date("2021-06-20T11:59:59Z")); // Based on the mocked system time
});
});
+93 -18
View File
@@ -13,7 +13,7 @@ import prisma from "@calcom/prisma";
import type { Booking } from "@calcom/prisma/client";
import type { SelectedCalendar } from "@calcom/prisma/client";
import type { AttributeType } from "@calcom/prisma/enums";
import { BookingStatus, RRResetInterval } from "@calcom/prisma/enums";
import { BookingStatus, RRTimestampBasis, RRResetInterval } from "@calcom/prisma/enums";
import type { EventBusyDate } from "@calcom/types/Calendar";
import type { CredentialForCalendarService } from "@calcom/types/Credential";
@@ -66,7 +66,11 @@ interface GetLuckyUserParams<T extends PartialUser> {
eventType: {
id: number;
isRRWeightsEnabled: boolean;
team: { parentId?: number | null; rrResetInterval: RRResetInterval | null } | null;
team: {
parentId?: number | null;
rrResetInterval: RRResetInterval | null;
rrTimestampBasis: RRTimestampBasis;
} | null;
includeNoShowInRRCalculation: boolean;
};
// all routedTeamMemberIds or all hosts of event types
@@ -81,17 +85,65 @@ interface GetLuckyUserParams<T extends PartialUser> {
weight?: number | null;
}[];
routingFormResponse: RoutingFormResponse | null;
meetingStartTime?: Date;
}
// === dayjs.utc().startOf("month").toDate();
const startOfMonth = () => new Date(Date.UTC(new Date().getUTCFullYear(), new Date().getUTCMonth(), 1));
const startOfMonth = (date: Date = new Date()) =>
new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1));
const startOfToday = () =>
new Date(Date.UTC(new Date().getUTCFullYear(), new Date().getUTCMonth(), new Date().getUTCDate()));
const startOfDay = (date: Date = new Date()) =>
new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()));
const endOfDay = (date: Date) =>
new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 23, 59, 59, 999));
const endOfMonth = (date: Date) =>
new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + 1, 0, 23, 59, 59, 999));
export const getIntervalEndDate = ({
interval,
rrTimestampBasis,
meetingStartTime,
}: {
interval: RRResetInterval;
rrTimestampBasis: RRTimestampBasis;
meetingStartTime?: Date;
}) => {
if (rrTimestampBasis === RRTimestampBasis.START_TIME) {
if (!meetingStartTime) {
throw new Error("Meeting start time is required");
}
if (interval === RRResetInterval.DAY) {
return endOfDay(meetingStartTime);
}
return endOfMonth(meetingStartTime);
}
return new Date();
};
export const getIntervalStartDate = ({
interval,
rrTimestampBasis,
meetingStartTime,
}: {
interval: RRResetInterval;
rrTimestampBasis: RRTimestampBasis;
meetingStartTime?: Date;
}) => {
if (rrTimestampBasis === RRTimestampBasis.START_TIME) {
if (!meetingStartTime) {
throw new Error("Meeting start time is required");
}
if (interval === RRResetInterval.DAY) {
return startOfDay(meetingStartTime);
}
return startOfMonth(meetingStartTime);
}
const getIntervalStartDate = (interval: RRResetInterval) => {
if (interval === RRResetInterval.DAY) {
return startOfToday();
return startOfDay();
}
return startOfMonth();
};
@@ -400,14 +452,16 @@ async function getCalendarBusyTimesOfInterval(
credentials: CredentialForCalendarService[];
userLevelSelectedCalendars: SelectedCalendar[];
}[],
interval: RRResetInterval
interval: RRResetInterval,
rrTimestampBasis: RRTimestampBasis,
meetingStartTime?: Date
): Promise<{ userId: number; busyTimes: (EventBusyDate & { timeZone?: string })[] }[]> {
return Promise.all(
usersWithCredentials.map((user) =>
getBusyCalendarTimes(
user.credentials,
getIntervalStartDate(interval).toISOString(),
new Date().toISOString(),
getIntervalStartDate({ interval, rrTimestampBasis, meetingStartTime }).toISOString(),
getIntervalEndDate({ interval, rrTimestampBasis, meetingStartTime }).toISOString(),
user.userLevelSelectedCalendars,
true,
true
@@ -425,20 +479,25 @@ async function getBookingsOfInterval({
virtualQueuesData,
interval,
includeNoShowInRRCalculation,
rrTimestampBasis,
meetingStartTime,
}: {
eventTypeId: number;
users: { id: number; email: string }[];
virtualQueuesData: VirtualQueuesDataType | null;
interval: RRResetInterval;
includeNoShowInRRCalculation: boolean;
rrTimestampBasis: RRTimestampBasis;
meetingStartTime?: Date;
}) {
return await BookingRepository.getAllBookingsForRoundRobin({
eventTypeId: eventTypeId,
users,
startDate: getIntervalStartDate(interval),
endDate: new Date(),
startDate: getIntervalStartDate({ interval, rrTimestampBasis, meetingStartTime }),
endDate: getIntervalEndDate({ interval, rrTimestampBasis, meetingStartTime }),
virtualQueuesData,
includeNoShowInRRCalculation,
rrTimestampBasis,
});
}
@@ -569,7 +628,7 @@ async function fetchAllDataNeededForCalculations<
>(getLuckyUserParams: GetLuckyUserParams<T>) {
const startTime = performance.now();
const { availableUsers, allRRHosts, eventType } = getLuckyUserParams;
const { availableUsers, allRRHosts, eventType, meetingStartTime } = getLuckyUserParams;
const notAvailableHosts = (function getNotAvailableHosts() {
const availableUserIds = new Set(availableUsers.map((user) => user.id));
return allRRHosts.reduce(
@@ -594,7 +653,15 @@ async function fetchAllDataNeededForCalculations<
const { attributeWeights, virtualQueuesData } = await prepareQueuesAndAttributesData(getLuckyUserParams);
const interval = getLuckyUserParams.eventType.team?.rrResetInterval ?? RRResetInterval.MONTH;
const interval =
eventType.isRRWeightsEnabled && getLuckyUserParams.eventType.team?.rrResetInterval
? getLuckyUserParams.eventType.team?.rrResetInterval
: RRResetInterval.MONTH;
const rrTimestampBasis =
eventType.isRRWeightsEnabled && getLuckyUserParams.eventType.team?.rrTimestampBasis
? getLuckyUserParams.eventType.team.rrTimestampBasis
: RRTimestampBasis.CREATED_AT;
const [
userBusyTimesOfInterval,
@@ -606,7 +673,9 @@ async function fetchAllDataNeededForCalculations<
] = await Promise.all([
getCalendarBusyTimesOfInterval(
allRRHosts.map((host) => host.user),
interval
interval,
rrTimestampBasis,
meetingStartTime
),
getBookingsOfInterval({
eventTypeId: eventType.id,
@@ -616,6 +685,8 @@ async function fetchAllDataNeededForCalculations<
virtualQueuesData: virtualQueuesData ?? null,
interval,
includeNoShowInRRCalculation: eventType.includeNoShowInRRCalculation,
rrTimestampBasis,
meetingStartTime,
}),
getBookingsOfInterval({
@@ -624,6 +695,8 @@ async function fetchAllDataNeededForCalculations<
virtualQueuesData: virtualQueuesData ?? null,
interval,
includeNoShowInRRCalculation: eventType.includeNoShowInRRCalculation,
rrTimestampBasis,
meetingStartTime,
}),
getBookingsOfInterval({
@@ -634,6 +707,8 @@ async function fetchAllDataNeededForCalculations<
virtualQueuesData: virtualQueuesData ?? null,
interval,
includeNoShowInRRCalculation: eventType.includeNoShowInRRCalculation,
rrTimestampBasis,
meetingStartTime,
}),
prisma.host.findMany({
@@ -644,7 +719,7 @@ async function fetchAllDataNeededForCalculations<
eventTypeId: eventType.id,
isFixed: false,
createdAt: {
gte: getIntervalStartDate(interval),
gte: getIntervalStartDate({ interval, rrTimestampBasis, meetingStartTime }),
},
},
}),
@@ -720,8 +795,8 @@ async function fetchAllDataNeededForCalculations<
in: allRRHosts.map((host) => host.user.id),
},
end: {
lte: new Date(),
gte: getIntervalStartDate(interval),
lte: getIntervalEndDate({ interval, rrTimestampBasis, meetingStartTime }),
gte: getIntervalStartDate({ interval, rrTimestampBasis, meetingStartTime }),
},
},
select: {
@@ -318,6 +318,7 @@ export async function getTeamWithoutMembers(args: {
metadata: true,
bookingLimits: true,
rrResetInterval: true,
rrTimestampBasis: true,
includeManagedEventsInLimits: true,
parent: {
select: {
+58 -1
View File
@@ -2,7 +2,7 @@ import prismaMock from "../../../../tests/libs/__mocks__/prisma";
import { describe, it, expect, beforeEach, vi } from "vitest";
import { BookingStatus } from "@calcom/prisma/enums";
import { BookingStatus, RRTimestampBasis } from "@calcom/prisma/enums";
import { BookingRepository } from "./booking";
@@ -188,5 +188,62 @@ describe("BookingRepository", () => {
expect(bookings).toHaveLength(4);
});
});
it("should use start time as timestamp basis for the booking count", async () => {
await Promise.all([
prismaMock.booking.create({
data: {
userId: 1,
uid: "booking_may",
eventTypeId: 1,
status: BookingStatus.ACCEPTED,
attendees: {
create: {
email: "[email protected]",
noShow: false,
name: "Test 1",
timeZone: "America/Toronto",
},
},
startTime: new Date("2025-05-26T00:00:00.000Z"),
endTime: new Date("2025-05-26T01:00:00.000Z"),
createdAt: new Date("2025-05-03T00:00:00.000Z"),
title: "Test Event",
},
}),
prismaMock.booking.create({
data: {
userId: 1,
uid: "booking_june",
eventTypeId: 1,
status: BookingStatus.ACCEPTED,
attendees: {
create: {
email: "[email protected]",
noShow: true,
name: "Test 1",
timeZone: "America/Toronto",
},
},
startTime: new Date("2025-06-26T00:00:00.000Z"),
endTime: new Date("2025-06-26T01:00:00.000Z"),
createdAt: new Date("2025-05-03T00:00:00.000Z"),
title: "Test Event",
},
}),
]);
const bookings = await BookingRepository.getAllBookingsForRoundRobin({
users: [{ id: 1, email: "[email protected]" }],
eventTypeId: 1,
startDate: new Date("2025-06-01T00:00:00.000Z"),
endDate: new Date("2025-06-30T23:59:00.000Z"),
includeNoShowInRRCalculation: true,
virtualQueuesData: null,
rrTimestampBasis: RRTimestampBasis.START_TIME,
});
expect(bookings).toHaveLength(1);
expect(bookings[0].startTime.toISOString()).toBe(new Date("2025-06-26T00:00:00.000Z").toISOString());
});
});
});
+19 -6
View File
@@ -4,6 +4,7 @@ import type { FormResponse } from "@calcom/app-store/routing-forms/types/types";
import { withReporting } from "@calcom/lib/sentryWrapper";
import prisma, { bookingMinimalSelect } from "@calcom/prisma";
import type { Booking } from "@calcom/prisma/client";
import { RRTimestampBasis } from "@calcom/prisma/enums";
import { BookingStatus } from "@calcom/prisma/enums";
import { UserRepository } from "./user";
@@ -47,6 +48,7 @@ const buildWhereClauseForActiveBookings = ({
users,
virtualQueuesData,
includeNoShowInRRCalculation = false,
rrTimestampBasis,
}: {
eventTypeId: number;
startDate?: Date;
@@ -60,6 +62,7 @@ const buildWhereClauseForActiveBookings = ({
};
} | null;
includeNoShowInRRCalculation: boolean;
rrTimestampBasis: RRTimestampBasis;
}): Prisma.BookingWhereInput => ({
OR: [
{
@@ -86,12 +89,19 @@ const buildWhereClauseForActiveBookings = ({
status: BookingStatus.ACCEPTED,
eventTypeId,
...(startDate || endDate
? {
createdAt: {
...(startDate ? { gte: startDate } : {}),
...(endDate ? { lte: endDate } : {}),
},
}
? rrTimestampBasis === RRTimestampBasis.CREATED_AT
? {
createdAt: {
...(startDate ? { gte: startDate } : {}),
...(endDate ? { lte: endDate } : {}),
},
}
: {
startTime: {
...(startDate ? { gte: startDate } : {}),
...(endDate ? { lte: endDate } : {}),
},
}
: {}),
...(virtualQueuesData
? {
@@ -290,6 +300,7 @@ export class BookingRepository {
endDate,
virtualQueuesData,
includeNoShowInRRCalculation,
rrTimestampBasis,
}: {
users: { id: number; email: string }[];
eventTypeId: number;
@@ -303,6 +314,7 @@ export class BookingRepository {
};
} | null;
includeNoShowInRRCalculation: boolean;
rrTimestampBasis: RRTimestampBasis;
}) {
const allBookings = await prisma.booking.findMany({
where: buildWhereClauseForActiveBookings({
@@ -312,6 +324,7 @@ export class BookingRepository {
users,
virtualQueuesData,
includeNoShowInRRCalculation,
rrTimestampBasis,
}),
select: {
id: true,
@@ -558,6 +558,7 @@ export class EventTypeRepository {
name: true,
slug: true,
parentId: true,
rrTimestampBasis: true,
parent: {
select: {
slug: true,
@@ -764,6 +765,7 @@ export class EventTypeRepository {
select: {
parentId: true,
rrResetInterval: true,
rrTimestampBasis: true,
},
},
},
@@ -839,6 +841,7 @@ export class EventTypeRepository {
includeManagedEventsInLimits: true,
parentId: true,
rrResetInterval: true,
rrTimestampBasis: true,
},
},
parent: {
@@ -0,0 +1,5 @@
-- CreateEnum
CREATE TYPE "RRTimestampBasis" AS ENUM ('CREATED_AT', 'START_TIME');
-- AlterTable
ALTER TABLE "Team" ADD COLUMN "rrTimestampBasis" "RRTimestampBasis" NOT NULL DEFAULT 'CREATED_AT';
+6
View File
@@ -478,6 +478,7 @@ model Team {
metadata Json?
theme String?
rrResetInterval RRResetInterval? @default(MONTH)
rrTimestampBasis RRTimestampBasis @default(CREATED_AT)
brandColor String?
darkBrandColor String?
verifiedNumbers VerifiedNumber[]
@@ -1526,6 +1527,11 @@ enum RRResetInterval {
DAY
}
enum RRTimestampBasis {
CREATED_AT
START_TIME
}
model SelectedSlots {
id Int @id @default(autoincrement())
eventTypeId Int
@@ -16,7 +16,7 @@ import { CalVideoSettingsRepository } from "@calcom/lib/server/repository/calVid
import { validateBookerLayouts } from "@calcom/lib/validateBookerLayouts";
import type { PrismaClient } from "@calcom/prisma";
import { WorkflowTriggerEvents } from "@calcom/prisma/client";
import { SchedulingType, EventTypeAutoTranslatedField } from "@calcom/prisma/enums";
import { SchedulingType, EventTypeAutoTranslatedField, RRTimestampBasis } from "@calcom/prisma/enums";
import { eventTypeAppMetadataOptionalSchema } from "@calcom/prisma/zod-utils";
import { eventTypeLocations } from "@calcom/prisma/zod-utils";
@@ -143,6 +143,7 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
name: true,
slug: true,
parentId: true,
rrTimestampBasis: true,
parent: {
select: {
slug: true,
@@ -211,6 +212,10 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
eventTypeColor: eventTypeColor === null ? Prisma.DbNull : (eventTypeColor as Prisma.InputJsonObject),
disableGuests: guestsField?.hidden ?? false,
seatsPerTimeSlot,
maxLeadThreshold:
eventType.team?.rrTimestampBasis && eventType.team?.rrTimestampBasis !== RRTimestampBasis.CREATED_AT
? null
: rest.maxLeadThreshold,
};
data.locations = locations ?? undefined;
@@ -7,7 +7,7 @@ import { validateIntervalLimitOrder } from "@calcom/lib/intervalLimits/validateI
import { uploadLogo } from "@calcom/lib/server/avatar";
import { isTeamAdmin } from "@calcom/lib/server/queries/teams";
import { prisma } from "@calcom/prisma";
import { RedirectType } from "@calcom/prisma/enums";
import { RedirectType, RRTimestampBasis } from "@calcom/prisma/enums";
import { teamMetadataSchema } from "@calcom/prisma/zod-utils";
import { TRPCError } from "@trpc/server";
@@ -67,6 +67,7 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
bookingLimits: input.bookingLimits ?? undefined,
includeManagedEventsInLimits: input.includeManagedEventsInLimits ?? undefined,
rrResetInterval: input.rrResetInterval,
rrTimestampBasis: input.rrTimestampBasis,
};
if (input.logo && input.logo.startsWith("data:image/png;base64,")) {
@@ -103,6 +104,22 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
data,
});
if (
data.rrTimestampBasis &&
data.rrTimestampBasis !== RRTimestampBasis.CREATED_AT &&
prevTeam.rrTimestampBasis === RRTimestampBasis.CREATED_AT
) {
// disable load balancing for all event types
await prisma.eventType.updateMany({
where: {
teamId: input.id,
},
data: {
maxLeadThreshold: null,
},
});
}
if (updatedTeam.parentId && prevTeam.slug) {
// No changes made lets skip this logic
if (updatedTeam.slug === prevTeam.slug) return;
@@ -148,6 +165,7 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
bookingLimits: updatedTeam.bookingLimits as IntervalLimit,
includeManagedEventsInLimits: updatedTeam.includeManagedEventsInLimits,
rrResetInterval: updatedTeam.rrResetInterval,
rrTimestampBasis: updatedTeam.rrTimestampBasis,
};
};
@@ -21,6 +21,7 @@ export type TUpdateInputSchema = {
bookingLimits?: IntervalLimit | null;
includeManagedEventsInLimits?: boolean;
rrResetInterval?: "DAY" | "MONTH";
rrTimestampBasis?: "CREATED_AT" | "START_TIME";
};
export const ZUpdateInputSchema: z.Schema<TUpdateInputSchema> = z.object({
@@ -46,4 +47,5 @@ export const ZUpdateInputSchema: z.Schema<TUpdateInputSchema> = z.object({
bookingLimits: intervalLimitsType.optional(),
includeManagedEventsInLimits: z.boolean().optional(),
rrResetInterval: z.enum(["DAY", "MONTH"]).optional(),
rrTimestampBasis: z.enum(["CREATED_AT", "START_TIME"]).optional(),
});