Keep track of recurring actions (with dates)

I’m working on an app where users need to complete various tasks every week, and it has a gamification aspect, so I need to record EACH unique date that specific actions took place.

To give an analogous example, let’s say a user has to run a mile every week, and we need to know the cumulative dates that an action has been completed. Obviously you have a user database and action database (run a mile), but let’s say you want to record how many times a user has taken that action over time. How would you record the multiple dates? (e.g. User “ABC” has “Ran a Mile” on 1/2/2021, 1/9/2021, 1/16/2021, etc.)

Is there anyway to do that? If not, any ideas for a workaround?

If it can’t be done for specific dates, any ideas for figuring out the cumulative totals (e.g. the User has “Ran a Mile” 25 times, even though we might not know the specific dates)?

I’d greatly appreciate any help :grin: :pray:

I would create an ‘action dates’ collection (database) with a relationship to the action collection then you can have one record with multiple dates and you can show the dates in a list as it is related to an action. You can also do counts of ‘action dates’ records to show totals.

The reason I would do it this way is because there is no grouping function for lists so you could not show a grouped list of actions according to a date if you had the dates in the actions collection, if that makes sense.

You can use your current 2 collections to achieve this.

Users collection will have 1-many relationship with Run a mile collection. [User has many run a mile, but run a mile record has only 1 user]

Each time a user runs a mile, you can add a record to run a mile collection with the date of activity.

When you want to show this: you can create a list filtered by the Run a Mile collection for the user, since it already has the relationship with User collection, you’ll see the list with all the dates that particular user ran a mile.

If you want to show this to a coach for example (who wants to know list of all the coachees who ran a mile with dates) - you can create a nested list. Parent list with users and child list with the dates of run a mile collection with the user.

1 Like

Thanks Bhanu!

For additional clarity, if the actions are consistent across all users (e.g. every user could choose “run a mile” from an existing list), then it would be a many-to-many instead of 1-to-many?

And just to mention, I have it as an “Action” collection, and the “Run a mile” as a record within the collection. I think the record would still be recorded multiple times using the many-to-many (e.g. the User can “Run a mile” multiple times, and multiple users are able to “Run a mile”). Am I thinking about this correctly?

Did you try my possible solution?

Hey Craigo - thanks for your recommendation! Yes, I’m going to use “Completed Actions” as a new collections, that has the “action” + “user” as records (and the “date created” is automatically captured). This should definitely accomplish what I need.

Thanks again for your advice!

Stuart

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.