[SOLVED] Count function will get wrong result

I’m creating a voting system. Voting is fine, and every user has a 3 votes limit per idea (similar to https://www.uservoice.com/).
The issue is that while the user’s votes count is fine (find votes [from user]:count), the remove vote workflow always gets a wrong result (find votes [from user]:count) -1.

What am I doing wrong?

The count function (working fine)

The workflow count function in a boolean (not working)

Debugger

Looks complex, I might be tempted to have two different workflow actions. I wonder if it removing the voter “user” first, so that messes up your search ?

1 Like

@NigelG I thought of use the value from the working logic, and subtract it from the current value, but I coundn’t do it…I’ll try something during the week.

As Bubble don’t have brackets etc (yet), it must be needed to break the boolean in two workflows…

Sorry. I just re-read your original post. I just realized that each user gets 3 votes per idea… :sweat_smile: haha

That being said though - in terms of UI - if you had a text box that shows a count (0-3) that’s counts how many votes the current user has submitted on that particular post…

THEN you could get away with having a
Votos = current cells ideas votes - 1 workflow.
A user would just have to click “remove” 3 times if they wanted to remove all three votes :slight_smile:
(More workflows though, so not ideal + removing the user from the idea would have to be done in a different way)

Brackets may be needed - I personally don’t see anything wrong with your screenshot…

1 Like

Wait - what about this:

A vote button
A remove button
And a text box counter (for current user)

So when vote is clicked = +1
But when remove is clicked = current cells vote count - (text box’s value)
Then up to 3 votes could be removed with one workflow…

^ you may have to set the state of the text box to “current user” as well though - to avoid data overlap from other active users? I don’t know…

Sorry to bombard this forum posts ( some of my ideas anyway :slight_smile: )

1 Like

What I did was creating a “vote” object, so to count a user vote I do a search to find for votes created by current user with the name = current idea. This works, but the issue is to remove those same, the count goes alway 1 :frowning:

PS - thanks for posting, I’m stuck with this

PPS - I think the better solution is to get result from count that’s working and and in the remove wf instead of making the count again, just link from the count result - that made sense? I couldn’t reach that result in a wf…

I think you can do that, with the text box idea…

Rather then have:

Votos = Current Cell’s Idea’s Votos - Search for votes:count

It could be

Votos = Current Cells Ideas Votos - (Group Number 1)s Number

Group Number 1 could be a visual with data that does the Search for votes function in advance…

So I created a visual of what I see in my mind here:

It does not work properly :sweat_smile: I do not understand all of your data. But it may be a possible solution.

I filled out the workflows with a rough example of how I thought it might work.

1 Like

I’ll try this setup, thanks for the idea

I think I’ll simplify my voting set up. I’ll post news then

1 Like

I got it to work, but don’t know how :sweat_smile: I redone everything, and tested with search for votes:sum
instead of :count
Nicer than Uservoice!

I track the app development in Github, so no issues now! :smile:

Thanks all the help fellow Bubblers.

3 Likes