Fixes https://gitlab.com/food-rescue-alliance/tomato/-/issues/238
- Create a recurring shift with a defined count (say 4)
- Update a shift part way through the count (say 3rd) and chose "this and following events"
You'd get 4 new shifts plus the 2 shifts before the edited one. Not great!
The problem was that editing "this and following" duplicated the event properties, including the rrule which includes the UNTIL attribute unchanged. It knew to modify the old event to stop at a particular date, but not the new one.
The fix came in three parts:
- The old event's
COUNT is removed (along with the UNTIL still being set)
- The new event's remaining
COUNT is calculated
- If the user also updated the recurring options in the UI, we ignore the new
COUNT and just use what they passed in.
Fixes https://gitlab.com/food-rescue-alliance/tomato/-/issues/238
1. Create a recurring shift with a defined count (say 4)
2. Update a shift part way through the count (say 3rd) and chose "this and following events"
You'd get 4 _new_ shifts plus the 2 shifts before the edited one. Not great!
The problem was that editing "this and following" duplicated the event properties, including the rrule which includes the `UNTIL` attribute unchanged. It knew to modify the old event to stop at a particular date, but not the new one.
The fix came in three parts:
* The old event's `COUNT` is removed (along with the `UNTIL` still being set)
* The new event's remaining `COUNT` is calculated
* If the user _also_ updated the recurring options in the UI, we ignore the new `COUNT` and just use what they passed in.