[18.0][IMP] resource_booking: per-resource booking buffer (post-booking cooldown)#221
Open
dnplkndll wants to merge 1 commit into
Open
[18.0][IMP] resource_booking: per-resource booking buffer (post-booking cooldown)#221dnplkndll wants to merge 1 commit into
dnplkndll wants to merge 1 commit into
Conversation
Contributor
|
Hi @pedrobaeza, @ows-cloud, |
a2366b0 to
9db1b78
Compare
…ldown) Add a Float field booking_buffer (hours, SQL-constrained nonnegative, default 0) on resource.resource. When non-zero, the resource is treated as busy for that many hours after each scheduled booking ends, so the next slot cannot start within the cooldown window. Wire it into _get_intervals via a new _get_buffered_booking_intervals helper that scans recently-ending overlapping bookings sharing at least one buffered resource, then subtracts the cooldown windows from the candidate availability. Default 0 preserves the existing back-to-back slot behavior. Useful for resources that need cleanup/reset/turnaround time between appointments (rooms, equipment, etc.) without inflating the booking duration itself. Co-Authored-By: Brenden Eshbach <brenden@techsystech.com>
a822643 to
1e5644e
Compare
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.
Add a Float field
booking_buffer(hours, SQL-constrained nonnegative, default 0) onresource.resource. When non-zero, the resource is treated as busy for that many hours after each scheduled booking ends, so the next slot cannot start within the cooldown window.Implementation: new
_get_buffered_booking_intervalshelper that scans recently-ending overlapping bookings sharing at least one buffered resource, then subtracts the cooldown windows from candidate availability in_get_intervals. Default 0 preserves the existing back-to-back slot behavior.Useful for resources that need cleanup/reset/turnaround time between appointments (rooms, equipment, etc.) without inflating the booking duration itself.
Adds 3 tests in
tests/test_backend.py:test_booking_buffer_blocks_following_slots,..._zero_keeps_legacy_behavior,..._constraint. New viewresource_resource_views.xmlexposes the field on the form/list./ocabot merge minor