fix(bookings): duration limit of seated booking makes available seats unavailable to book#28448
Open
bandhan-majumder wants to merge 2 commits intocalcom:mainfrom
Open
fix(bookings): duration limit of seated booking makes available seats unavailable to book#28448bandhan-majumder wants to merge 2 commits intocalcom:mainfrom
bandhan-majumder wants to merge 2 commits intocalcom:mainfrom
Conversation
Graphite Automations"Send notification to Community team when High Priority PR opened" took an action on this PR • (03/15/26)2 teammates were notified to this PR based on Keith Williams's automation. |
| const bookingRepo = new BookingRepository(prisma); | ||
|
|
||
| // seated events with more than 1 seat, check if the user is joining an existing slot | ||
| if (seatsPerTimeSlot && seatsPerTimeSlot > 1) { |
Contributor
Author
There was a problem hiding this comment.
1 seat available slots are kind of same like normal bookings with no offer seats. So, the logic to group seats to a single booking while counting total duration is implemented here when seats are more than 1
Contributor
There was a problem hiding this comment.
5 issues found across 9 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/bookings/lib/checkDurationLimits.ts">
<violation number="1" location="packages/features/bookings/lib/checkDurationLimits.ts:81">
P2: New seat-limit errors are thrown as 403 but immediately remapped to 401, so the intended capacity status is not propagated.</violation>
</file>
<file name="packages/trpc/server/routers/viewer/slots/util.ts">
<violation number="1" location="packages/trpc/server/routers/viewer/slots/util.ts:487">
P2: Seat-aware duration handling was added only for PER_YEAR; PER_DAY/PER_WEEK/PER_MONTH still sum each seated booking row and can overcount duration, causing premature busy limits.</violation>
</file>
<file name="packages/features/bookings/repositories/BookingRepository.test.ts">
<violation number="1" location="packages/features/bookings/repositories/BookingRepository.test.ts:68">
P2: New duration-limit tests are assertion-light: they only validate mocked totals, not seat-aware/reschedule SQL branch behavior.</violation>
</file>
<file name="packages/features/availability/lib/getUserAvailability.ts">
<violation number="1" location="packages/features/availability/lib/getUserAvailability.ts:649">
P2: Duration-limit seat restoration updates only `dateRanges`, leaving `oooExcludedDateRanges` stale and causing booking checks that rely on `oooExcludedDateRanges` to still reject restored slots.</violation>
<violation number="2" location="packages/features/availability/lib/getUserAvailability.ts:672">
P2: Seat-based availability restoration ignores the requested duration override and always restores using `eventType.length`, which can produce incorrect availability ranges for custom-duration requests.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| if (totalBookingDuration < limitingNumber) return; | ||
| if (slotStatus.exists) { | ||
| if (slotStatus.isSeatFull) { |
Contributor
Author
There was a problem hiding this comment.
when someone tries to book a seated booking even though seat is full via api (UI won\t show). This is for a safety check.
| // seated events durations are calculated based on unique time slots, not individual bookings | ||
| // seatsPerTimeSlot >= 1 indicates a seated event | ||
| // but having a single seat or seatsPerTimeSlot == 1, is same as calculating based on individual bookings | ||
| const shouldGroupSeatsAsSingleBooking = seatsPerTimeSlot !== null && seatsPerTimeSlot !== undefined && seatsPerTimeSlot > 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
unblocks same slots with available seats for others to book after the booking duration limit is met. It also sends
seating_limit_reachederror when slots are full. Users only sees available slots if seats are available.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):
Before:
before.mp4
After:
after.mp4
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Checklist