Adjacent Buffering and Dynamic Buffering not always working the same
Buffering in Bookings works like this:
When you have a bookable slot, you can buffer after that slot by a defined range.
For example, I have hourly slots, and I can then choose hourly buffer periods after each of them.
If I have slots from 7am - 12pm - that means I'd have 6 slots.
If I have 1 hour Buffers, it automatically sets the buffers and so my available slots are:
`7am, 9am, 11am`
When I select Adjacent buffering, the button states this:
> By default buffer period applies forward into the future of a booking. Enabling this option will apply adjacently (before and after Bookings).
What I think this means is that my bookable slots will get a buffer period before and after each slot. Which they already do have. However, what ends up happening is that I now get these as bookable slot:
That's because you have 2 buffer slots between each slot now. I didn't want 2 buffer slots, I just wanted to make sure that there was buffering before and after.
_This brings up a lot of questions._
We've had ongoing discussions on how Buffer Periods should work in https://github.com/woocommerce/woocommerce-bookings/issues/959 and in https://github.com/woocommerce/woocommerce-bookings/issues/1444 and it seems like the consensus is that Buffering should be either Dynamic or Preset. In other words, you get to pick if your buffering happens before anyone makes a Booking, or if the buffering is applied after Bookings are made. Right now we are tracking this as an enhancement... but read on for more juicy details.
I think there are a few things currently broken:
1. Adjacent Buffering works differently for Hour blocks and Day blocks
2. There is too much Adjacent buffering going on for Hour blocks
3. We sometimes do Dynamic Buffering, and sometimes don't, this should be consistent
**Adjacent Buffering doesn't work for Hour blocks:**
If I remember correctly, I think Adjacent Buffering was created when we tried to implement Dynamic Buffering, and it only makes sense in that context. If I have all my slots open:
`7am, 8am, 9am, 10am, 11am, 12pm`
And I then book `9am` - by default, the Dynamic Buffering would only move forward and make `10am` unbookable. However, if you had Adjacent Buffering checked, it would help you set a buffer in both directions. This makes sense in this context.
In the current context that we have, Adjacent Buffering makes no sense because it adds extra buffering periods without looking at already existing buffering periods there, so it doubles the buffering basically.
**Dynamic Buffering, but only sometimes**
If you take a look at how Buffering works in a Days context, it gets weird.
If I have it set to Bookable blocks of 1 day, and I require a 1-day buffer, no buffer shows:
![screen shot 2017-12-14 at 10 43 52 am](https://user-images.githubusercontent.com/3220162/34008910-c26be6ba-e0bb-11e7-9677-7a7e44738f5f.png)
This is odd because, for hour bookings, it automatically buffers from the start, but for Days it does not. Why not? I would expect that it would automatically create buffer periods ahead of time and every other day would be unavailable
If I then book one day, the 17th of Jan, you can see the buffering then applies to the next day:
![screen shot 2017-12-14 at 10 46 23 am](https://user-images.githubusercontent.com/3220162/34009005-0beedd24-e0bc-11e7-9802-dd6f85ac6ced.png)
If I then select Adjacent Buffering, again, it works by adding 1 buffer slot before and after:
![screen shot 2017-12-14 at 10 47 48 am](https://user-images.githubusercontent.com/3220162/34009050-3f1bc84c-e0bc-11e7-98af-19dd0b60c8c6.png)
That's Dynamic Buffering!! :)
1. For now, we should remove Adjacent buffering when it's bookable by the Hour. It doesn't make any sense in how it currently works.
2. If we have Dynamic Buffering for days, we should also have Dynamic Buffering for Hours, and make it the default.
3. We should remove preset buffering entirely - that's what Availability rules are for. I don't think users would use preset buffers because they can just say "2 hour periods" instead of buffering rules that can be flaky. I can't think of a use for this but I'm open to hearing if others can think of one.
4. When we add Dynamic Buffering for Hours as well, we should bring back Adjacent Buffering for hours only in that context.
Also, I tagged this as a bug and enhancement, which I think is confusing but also accurate ????
Buffering is sooo broke.
I want customers to book their own appointments in 30-minute blocks with a 5-minute break at the end of each appointment. Customers can reserve between 30 minutes and 2 hours (1 to 4 blocks) in a single appointment. I set "Booking Duration" to Customer-defined blocks of 30 minutes. Set min/max duration to 1 and 4 (30 minutes to 2 hours). Then under "Availability" set "Require Buffer Period" to 5 minutes. The result should be first available appointment at 9:00, second at 9:35, third at 10:10, etc. Instead I get first available appointment at 9:00, second at 10:05, third at 11:10. It's adding a full BLOCK, plus the buffer period. If customer tries to make a 1-hour appointment (2 blocks), the first available is 9:00, second is 10:35, third is 12:10 - again adding a full 30-minute block plus the buffer period.
For what you charge for this plugin, you should be able to get this right. Bookly does it right.