I am creating a recurring to-do item app. Let’s say a user wants to add a to-do item daily. I can set up a backend workflow to create the to-do items, but it would endlessly create database items.
Even if I allow the user to only add to-dos up to 1 year in the future, the back-end would have to create 365 database items. If I have a lot of users, that’s a lot of capacity being used.
What’s the best way to handle this? Even if the user deletes the to-do item, I’d like to retain all the past to-do items (which would require them to individual database items, right?)
Why couldn’t the user create a daily to do item and it just be one item instead of 365 per year. Just put give each item a list of numbers which would correspond to the days of the week (Sunday = 0, Monday = 1, etc…). Then if the User says they want this to be daily then that items list of numbers should equal 0, 1, 2, 3, 4, 5, 6. Now on the part that displays the to do items just make sure item’s list of numbers contains current date/time extract day. You could also give each to do item a yes/no field called active in case they want to temporarily turn it off they can change the active to no. Then when displaying add the conditional that this item’s yes/no is yes.
How would you then handle if a to-do item has been checked/not checked (like checked marked for being complete) for a given day?
Also, let’s say someone has a to-do item they do daily, but then they are finished. If the to do item is set to inactive (aka hidden) then they couldn’t see that specific to do item(s) they have completed in the past because it would be hidden.
You could have a separate field from active called complete which is also a yes/no and every time the user changes the complete to yes schedule a backend workflow to run at midnight for their timezone to turn it back to no.
They could have a page where they can see all to do item regardless of if they are active or not. Similar to a settings page. Then they would have something more considered a home page that displays everything depending on the way it was configured in their settings page. That way they can always see all to do items and edit them as needed.