I need help to allow users to only upvote a recipe once!

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 !

1 Like

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.

  1. Create a field under your recipe data type called “likes” of type numbers

  2. Create a field under your User data type called "likes of type “likes” and make it a list.

  3. 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.

  4. 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.

1 Like

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.

May not be the best way, but after the icon is clicked, Workflow a "Pause between next action for about 4000ms (4sec.) Then Workflow the icon to “Hide”.

The User will try to vote again during the pause and “think” they can’t Upvote anymore. Then the dang thing disappears.

Some people will catch up to refreshing the page, but who wants to go through that much trouble to upvote a few more times lol.