Database Madness - Running my self in cricles

Ok so I’ve tried to no avail to get this to work, so I’m hoping someone here much smart than I can help.

Here is my use case.

User “A” creates a “Holiday”
user a create an activity inside that holiday
The user can update the activity and assign it a category eg: “beach”
The category is picked from a pre-created list of 6 options.
The user can then apply a score to this category eg: 10
The user can then create another activity
if they select the same category such as “beach” and apply a score then it should show the cumulative total score
… this is where I got up to and after this I get stuck
Now the user creates a new activity and picks a different category eg: Shopping
the user applies the score to the category eg 5
the use can then view all categories and see their total score for each one.

For the life of me, I can not get this to happen.

I have created a database for the categories
I have created a database for activities
They have the relationship that a category can have many activities but activities can only have 1 category

Then I created a database called user activities
This is where I am trying to track the name of the category and the total score for that category.
When a user updates and activity with a new (previously unselected) category and a score I create a new entry in the “user activity database”

BUT if the user creates an activity with a previously selected category I can not get it to add the score to the current total

please help!! I am so close to finishing my app, this is literally my last hurdle :frowning:

Hi @Tech55b,

Welcome to the forum!

If I got you right…

What I would suggest is having a DB Collection for user-category-activity, have the following properties there:

  • user relation
  • category relation
  • activity relation (by the way, are the activities fixed? If not, then you don’t need relation, it could be just a text field with activity name)
  • score

And then you can display total score for the category with SUM of score + filter by category + filter by user.

Best,
Victor.

Thank you Viktor for your time and wisdom today and helping me solve this issue.

1 Like