Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recurring tasks, how to implement in code

I'm working on a task manager app and want to add a recurring/repeating tasks feature. I have been thinking on how to get this working but can't really figure out the mechanics, how a recurring task recreate itself some time-frame in the future.

Suppose I would create a recurring task for every Monday at 8:00 starting from next week. Now suppose I don't use the app for the next 3 weeks, then when I open the app should I see 3 task for each of the last 3 weeks ? Or only a new task for the next Monday ? In case I would choose the first option, when do I need to create those task, when the user opens the app or when he exits ?

I would be great if some could elaborate on this.

like image 992
Oysio Avatar asked Oct 31 '25 16:10

Oysio


1 Answers

Now suppose I don't use the app for the next 3 weeks, then when I open the app should I see 3 task for each of the last 3 weeks ?

This is entirely up to you. If you were using your app which would you prefer? Personally I would prefer that the old tasks are there regardless, but others might feel otherwise. Pick one or offer the user an option in your settings.

In case I would choose the first option, when do I need to create those task, when the user opens the app or when he exits ?

I think the right choice is to create the task when it becomes visible for the first time. For example, if you have a calendar, create the task the first time you display that day/month/week to the user. This way you are only creating tasks as they are needed.

I cannot stress enough though that it really depends on how you are presenting this information to the user.

like image 152
sosborn Avatar answered Nov 03 '25 07:11

sosborn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!