This is a hard topic that I’ve been working on for quite some time in 2017 and started working on again a week ago because of bug reports. I’m currently at a point where it’s hard for me to find out the best behavior, so I’d like your input on this!
Karrot currently tries to fulfill three requirements about pickups:
- no unexpected changes for pickup collectors: when anybody is signed up for a pickup, it shouldn’t get deleted or moved to a different time
- reliable changes to recurring pickups: when a recurring pickup gets changed, it should affect all existing upcoming pickups that were created as part of this recurring pickup
- allow exceptions to recurring pickups: if an individual pickup gets changed or deleted, these changes should be remembered even when the recurring pickup changes
As you might imagine, there’s sometimes a conflict between those requirements. For example, what should happen if someone joined the pickup on Monday, but then the series changes to Tuesday? Or another case: if a pickup Monday 20:00 gets cancelled, but then the recurring pickup changes to Monday 21:00, should the pickup at 21:00 stay cancelled?
When I started writing Karrot, I tried a rather simple way of resolving these conflicts. I didn’t update pickups automatically if they have been changed individually or if people signed up for them. But this lead to unpredictable behavior, such as duplicated pickups or pickups that show old information. After Karolina and Marta from foodsharing Warszawa helped me discover more cases where this simple algorithm turned rogue, I decided to spend some more time to make it better. But it’s been quite hard to find good solutions.
Adding and editing recurring pickups is a core functionality in Karrot and should be improved
My current idea is in order to fulfil requirement 2 better, drop requirement 1 and introduce cancelled pickups: pickups that don’t match the changed recurring pickup settings will get cancelled and a notification will get sent to people signed up for it. The notification should ideally contain a statement why the pickup was cancelled.
I would also partially drop requirement 3 and only remember exceptions if they actually match the recurring pickup. So if the rule says “Monday 20:00 every week” and there’s an exception (deleted pickup) for next Monday 20:00, we would remove the exception when the recurring pickup changes date or time, e.g. to “Monday 21:00” or “Tuesday 20:00”.
Also regarding requirement 3: if changes are being made to a pickup and then the recurring pickup changes, we would only keep that pickup if it matches. Otherwise, it will get deleted.
Alternatively, we could just drop requirement 3 and delete all exceptions when a time or day of a recurring pickup changes.
How does that sound to you?
Can you think of more use cases that might cause problems?
Do you have an idea how the behavior could be made simpler?