Toggle - previous selection is not saved AND unable to link toggle to the correct DB

Hello everyone,

I’m having issues implementing a toggle which will mark a completion of the ‘Workout Week’, ‘Workout Day’ or ‘Exercise’.

First Issue.
In my Workout Week List I was able to add a toggle and actions to create an entry every time the user is changing the state of the toggle, however once the screen is refreshed the toggle state is no longer showing.

Second issue.
In the lists for ‘Workout Days’ and ‘Exercises’ I’m unable to link toggle to my ‘Exercise Toggle Progress’ DB, I’m not sure how are those two different from the Workout Week.

Here is the video where I show the configuration: https://youtu.be/wkLwOoD_jgk

Any suggestions of how this can be fixed, would be appreciated!

@Vladyslav,

This is because you are using a separate collection for store what user toggle. So you need two icons instead of a toggle that is one for when there’s no record created for current workout week, workout day or exercise and another one to remove the selection so delete the record from the collection. Check this video made by @Victor that is using this method : https://youtu.be/_HS9WkDJbRk

To use a toggle, you don’t need a separate collection and you can build a many to many relationship with 3 collections (workout weeks, workout days and exercises ) to users collection. Check this video for example : https://youtu.be/e-SvIRQHOfA

@dilon_perera not sure if it will work with the Exercise collection, as the same Exercise can be in the multiple Workout Days. I think I need to do it via a separate collection where I store Week, Day, Exercise. Else, I’ll have a user ‘ticking’ Exercise in Day 1 and it will also be ticked in the Day 5, as it’s being reused…

I see… How the Workout Days collection works? Is it new records for each user or same record for each user?

When user clicks on the Workout Day, I update the user with the clicked Workout Day. As theoretically the user will only be using 1 workout day at the time. When the user goes to the Exercises, I show the list of the exercises that is linked to the workout day that is currently added to the user. Some what complicated… But I had to do it to future proof when adding new exercise plans

On another hand I think adding toggles to weeks and days should be enough… so you say I need many to many relations between Workout Days and Weeks? Could I have more than 1 relation set between the DBs?

Setting up Many2Many Between Users - Days/Weeks solved the problem For complete workout days and weeks. As per guide here https://youtu.be/e-SvIRQHOfA
I’m going to leave the idea of the complete button for the exercises themselves, else I’ll have users marking exercises as complete and this status will be carried over to other lists where the exercises are being reused… Unless I can somehow implement an expiry function, but I have no time for this now as I need to Publish soon. Problem for another day :slight_smile:
Thanks for your help @dilon_perera

Wait… Let me share a video tomorrow buddy!

1 Like

Check this video out! : video1243116290.mp4 - Google Drive

Also if same workout days are in workout weeks, you could do the same with using the same collection instead of M2M relationship.

1 Like

This is smart… I’m going to try to replicate this in my app

1 Like

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