🧙‍♂️ How to create a "Badge" reward system when users complete activities

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 :man_mage:

3 Likes

Extremely clever!

1 Like

Hello, can you explain how I would modify it so that I can set up the activities that will be rewarded? For example, if I want my user to receive a badge for creating a profile, or posting a certain amount of times, etc.?

Thank you so much! The explanation thus far has been very clear!

Hello! In first place, thank you for your guide, it’s awesome! By the way, I’m quite a newbie in this world and can’t find how to make a countdown timer. Could you help me? Thanks!

@buenajill Add a “Completed Activity” screen after registration with a countdown timer within a list of badges that has a custom filter for the specified badge. Do the same after the user posts x amount of times by using a condition on the action with the user’s post count.

Click the + icon to get to the components panel. Click “Explore Marketplace” and search “countdown”. Then click install.

1 Like

My bad, really, I didn’t see it on the marketplace… lol

1 Like

:laughing: no worries, glad you found the info helpful

1 Like

Yep, I just made it right now, many thanks!

I am sorry, I am a bit daft and need more explaining.

So, if I want my user to earn a badge after receiving five likes, I would create an activity that says “received five likes” then link this to…? I am still not getting how I create these activities that will then trigger the badge? Can you possible elaborate further, I am so sorry for the bother.