Implement Recurrence of Items
Currently, users can add a due date to certain items. This causes these items to show up in the Scheduled page.
Until now, marking an item there as done causes it's
done state to be set to true (for todos) or the due date to be removed (for any other kind of item). This means: The item can be scheduled exactly once.
For some workflows, it would be good if items could recur on a pattern which users could set up. So when a user marks such a scheduled item as done, in the future we should:
- For items without a recurrence pattern just set them as done (or remove the due date) as of now.
- For items with a recurrence pattern, calculate the next date on which the item is due and update the due date accordingly.
For the first iteration, we should add the following recurrence patterns (more can be added in the future):
- Every N days: The item recurs every Nth day.
- Weekly: The item recurs weekly on the same day.
- Monthly: The item recurs monthly on the same day.
For these three patterns, it could also make sense to implement an additional setting (which can be set by the user per item) to determine the anchor used for re-scheduling:
- Absolute: The next due date is selected based on the originally set due date, independent on when the user marks the current instance of the item as *done. If an item is set to recur weekly and the original item was set to be due on a Monday but the user marks the item as done on a Tuesday, then the next due date will again be on a Monday.
- Relative: The next due date is selected relative to the date when the user marks the item as done. So if an item is set to recur weekly and initially is set due on a Monday but the user closes it on a Tuesday, then the next due date will be scheduled on a Tuesday as well.