Today’s tutorial is a request from @Erik to create a reward system for when users complete activities in the app.
Erik: “Hey everyone, wondering if anyone has a good idea on how to reward users based on activity counts? For example, let’s say I have a fitness app where users run, swim, and bike. I have set badges (10 swims, 50 swims, 10 bikes, 25 bikes, etc), is there a good way to do this in adalo? or is it best to do it in integromat?”
Here’s how you can do it using just the internal Adalo database.
You’ll need 3 collections, Badges, Activities, and Entries.
Badges Collection:
Name (text)
Image
Milestone (number)
Activity (one-to-many where a badge belongs to 1 activity, activity can have multiple badges)
Users (many-to-many)
Activities Collection:
Name (text)
Badges relationship
Entries Collection:
Name (text)
User relationship (one-to-many where an entry belongs to 1 user, user can have many entries)
Activity relationship (entries can have 1 activity, activities can have more than 1 entry)
Have your list of activities that then links to an activity details screen.
Add a button to the details screen that creates an entry when a user completes the task and link to a new screen called “Completed activity”
Add an input and 2 countdown timers to the new “competed activity” screen. Set the default value of the input to logged-in user entries count with a filter where activity name is equal to current activity name. Rename the input “Entry Count Input”
With the first countdown timer, make a list of Badges > current activity badges where milestone is equal to entry count input with a maximum number of items set to 1. Set the visibility of this list to sometimes where current activity badges count is not equal to 0 where milestone is equal to entry count input. This timer rewards the user with a badge if there is a milestone number that matches that specific activity.
Add an action to update the badge to add the logged in user to this countdown and link to a “badge earned” screen.
For the 2nd countdown timer, set the visibility to sometimes when current activity badgeas count is equal to 0 where milestone is equal to entry count input. Add an action to link back to the list screen, in this case, it’s the home screen. This timer sends the user back without rewarding a badge to the user.
You can then make a list of the badges the user has earned:
That’s how you’d create a reward badge system