Conversation
added 2 commits
December 2, 2026 20:22
Blocking one day of a held day range now releases the other days of that cart item too, so they are not kept from other customers until the hold runs out and the cart no longer shows a hold label for an item it cannot book. The service trims the note and enforces its maximum length for every caller. A selection that is only partly blocked says how many slots were left out instead of blaming a booking.
A slot was blocked when its note was not empty, so every query had to test both null and the empty string. ProductReservation.IsBlocked now decides the state and the note only says why. Queries test IsBlocked != true, which also matches a slot stored before the field existed.
The rule that Clear calendar keeps blocked slots lived in the controller, which filtered the slots in memory and deleted them one by one. IProductReservationService.ClearCalendar now deletes the unblocked vacant slots in one filtered delete and returns what it deleted and kept. The blocked-slot query is one BlockedSlots helper next to BookableSlots.
| private IQueryable<ProductReservation> BookableSlots(string productId) | ||
| { | ||
| //!= true: a slot stored before the field has none, and only a test that is not "true" matches a missing field | ||
| return VacantSlots(productId).Where(x => x.IsBlocked != true); |
| var deleted = await _productReservationRepository.CountAsync(query); | ||
| //one filtered delete: a slot booked or blocked meanwhile is checked as it is deleted, and stays | ||
| await _productReservationRepository.DeleteManyAsync(x => | ||
| x.ProductId == productId && (x.OrderId == "" || x.OrderId == null) && x.IsBlocked != true); |
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.
Type: feature
Issue
Staff had no way to take a reservation slot out of sale (equipment under repair, a booking taken by phone) other than deleting it. A deleted slot is gone from the calendar, and generating the calendar again to bring it back adds duplicates of the slots that are still there.
Solution
ProductReservation.BlockedNote: a slot with a note is blocked. No migration — old documents read as not blocked.ProductReservationService(SlotsToBookfor the hour slot and the day range,GetAvailability,GetFirstVacantDates) skips it, so the cart validator, the checkout claim, the picker and the product page follow without changes of their own.BlockReservations(productId, ids, note)/UnblockReservations(productId, ids):EntityUpdated(audit trail).ReservationState.Blocked(booked > blocked > held > free); the grid's state filter has it, and the Free/Held filters leave blocked slots out.HasAccessscope and product filter as Delete selected.DefaultLanguage.xmlandUpgrade/en_250.xml(Admin and Vendor prefixes).Breaking changes
None.
IProductReservationServicegains two methods.Testing
Unit tests:
ProductReservationExtensionsTests(state of a blocked slot),ProductReservationServiceTests(availability by hours and by days, first vacant dates, hold and booking of a blocked hour slot, a day range around a blocked day, state filter, block/unblock incl. held, booked, another product's slot, replaced note, events, LiteDB, delete selected takes blocked slots),BaseProductReservationControllerTests(scope, required/too long note, trimmed note and distinct ids, booked slots reported, unblock, Clear calendar keeps blocked, Clear old deletes them, list state + note, POST only). Full solution green;Grand.Module.Api.Testsfailed one unrelated warehouse test once in the parallel run and passes on its own.E2E on a clone of the shared reservations DB (the clone has no new resources, so keys show):