Voting - Allow user to change vote

Hi

I have a fringe case within a voting system.

A user can only vote once but can change their vote.

The challenge I’m having is if the user is the first to upvote or downvote, Upvotes = 1 or -1. If they change their vote and the result of that initial change is 0 (i.e. no one else has voted yet), they should be able to change the vote from 1 to -1 or vice versa.

At the moment, Current User is stored against a record with 0 Upvotes which is incorrect but illustrates the User has changed their initial vote.

How would I overcome this?

Separate your workflows.

When a user downvotes, add to the downvote section, modify upvotes if necessary. Then vice-versa. Give it a try, let me know.

Yep - got it. Thanks!

I separated the workflow to include two steps. The first changes the count, and the second adds Current User only when Upvotes is not 0.

Added both steps to caret-up and caret-down. A user can change their vote from 1 to -1!

Glad it worked out for ya!

This topic was automatically closed after 70 days. New replies are no longer allowed.