When running a ranking poll with randomised options, the option number saved into the database does not match the vote_offset of the option the user ranked. This is because the ranking form uses the array index to uniquely identify each option and *not* the vote_offset, like it should.

If all users choose to rank the choice listed at the top of the form as their 1st, the winning choice is always the item from {decisions_choices} with vote_offset 1, regardless of where that item was in the list.

Attached patch fixes the issue.

Unfortunately, because the order of items is randomised, there is no way to find out actual results of polls that were run with this bug in place.

Please do not apply this patch without also fixing #1590244: "Randomize answers order" doesn't work on PHP >= 5.2.10.

Comments

cafuego’s picture

Issue summary: View changes

Updated issue summary.

cafuego’s picture

Component: Ranking mode » Code - Base Decisions module
StatusFileSize
new5.21 KB

Attached patch resolves this issue for both ranking and select votes. Additionally, it resolves issue #1590244: "Randomize answers order" doesn't work on PHP >= 5.2.10, so randomising options works properly on PHP >= 5.2.10.

webchick’s picture

Status: Needs review » Reviewed & tested by the community

Can confirm that this fixed randomization under PHP 5.3, and it is recording the proper vote on a ranking poll.

I don't really feel qualified to mark RTBC due to unfamiliarity with the rest of the code, but since this fixes a HUGE bug, I'm going to be bold.

anarcat’s picture

Status: Reviewed & tested by the community » Fixed

fix committed, thanks, sorry for the delays.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Add reference to randomise helper booboo.