Hello all, I’m new to Bubble but I read both the Bubble manual and the Airdev Canvas manual as well as did all the lessons and looked at the tutorials but I’m still pulling my hair at how to structure the database for my use case, at a high level
I think my biggest problem is to conceptualize how to structure the DB when there is a master list of tasks that every new user is assigned and has to do in a particular order and check off daily. It’s different from users creating their own tasks to complete, which maps to the classical To-do app use case.
All the use cases I have seen (To-do, marketplace, etc.) involve items belonging to users so it’s quite simple to just retrieve and display the things that “belong” to each user and each user only. What I’m trying to do is take the same list of tasks and have each user do them according to a specific schedule and record how they progress. Somehow, I can’t come up with a suitable DB structure for that.
My use case is a training plan to get users to implement a new habit per week by doing it daily. If they manage to do it daily for a week, then they get a new habit for the following to do in addition to the first habit which still has to be done.
There is the same training plan for everyone, for example the Covid inspired plan below:
- Habit 1: Wash your hands
- Habit 2: Wear a mask
- Habit 3: sneeze in your elbow
And the schedule is:
Week 1: complete Habit 1 each day (check a box to indicate you did it). If at the end of week 1, you did it everyday, then Week 2 is unlocked. If not, you start again with Week 1.
Week 2: same but you have both Habit 1 and Habit 2 to complete each day.
Week 3: same but you have Habit 1, 2 and 3 to complete each day.
Users only have a personal dashboard with the Habit to complete each day and they can indicate if they did it for the day.
It seems simple enough to me but when I try to think how to structure the DB for such an application, I’m going in circles as it doesn’t really map to any of the other use cases I have seen in the tutorials
I think where I struggle conceptually is that contrary to a more classical to-do app where I could create and retrieve To-dos easily based on the user who created them, here each user essentially has to complete the same set of daily tasks, in the same order, but at different dates based on when they sign up. I’m wondering how to best assign these tasks to users and record if/when they complete them.
The best I came up with are the following data types:
- Habit:
- Label field with name
- Habit ID
- Week:
- Week ID
- List of Habits in the week
- Habits done:
- Habit unique ID
- Date done
- User ID
- Active week:
- User:
- Active week
- Week 1 start date
- Week 2 expected finished date
- Week 2 start date
- Week 2 expected finished date
- etc.
I would then restrict the number of times a user can mark a habit done to once a day and then count the number of times a habit has been done in the week to mark each week complete.
This isn’t simple though and I’m wondering if I’m approaching the issue in the right way It seems like since I know the exact tasks a user has to complete when they sign up, I should be able to have a simpler structure.
On the other hand, if I were to, say, assign a user a task with a due date for each daily habit, then I would end up with 7+14+21=42 individual tasks to be completed and that is just for 3 weeks…
If anyone has taken the time to read until this point and has any pointers on what I could read to get better and see what I am missing, I would be immensely grateful!
Many thanks!
Julien