I need help to allow users to only upvote a recipe once in my app. Right now, they can press the Icon as many times as they want and upvote their recipe all day, and I can’t find how to make it so a user can only press the button once to upvote, then press it again to take their upvote out of the count! I believe I have to make a new data type in the database that will keep track of the the recipe and who liked it, so that you can easily use conditions and counts to accomplish the two conditions (One upvote per user, and take out the upvote with second click). Please help me if you can, I’m really stuck!
Use conditions on the upvote button itself (Enable / Disable as per user’s click)
Have a list of “Users who voted” on the Recipe.
Then on the Upvote button have a condition that disables it when the Recipe’s List of Users Who Voted contains Current User.
Add/Remove from list to do UpVote/Remove Upvote.
You can do the same thing with a list on the user as well. Either works, depends on if you need the list elsewhere. Or you can do both !
I’m sorry, but I’m still pretty confused on how/where I make the list of things, and how to disable it… is it possible for you to take pictures/take a video or describe a bit better how and what to do?
As with all things bubble, many ways to achieve it. I would try this first, just at the top of my head.
Create a field under your recipe data type called “likes” of type numbers
Create a field under your User data type called "likes of type “likes” and make it a list.
Step 1. Create a workflow when a user clicks the like button. Add This recipe’s likes count + 1
Step 2. Make change to current user add parent groups (I think it’s called) recipe.
On the like button, create a conditional, when current user’s Likes Recipe contains parent groups recipe, this button is not clickable.
why do I add it to the user as well as the recipe. It’s most likely much faster to just look at the list of current user than another type of search. But I could be wrong here, so you should probably run some speed tests.
Hey casheets123, on step two there is no type “Likes”… And on step 4, there is no Current user’s Likes Recipe! Could you help with that?
Add them to the “User” type in the DB.