xwikisas / application-xpoll

Simple poll application, Doodle like
0 stars 6 forks source link

Add support for a Condorcet method poll #76

Closed lucaa closed 3 years ago

lucaa commented 3 years ago

Currently the poll application supports simple voting for options and simple majority vote counting method for announcing the winner.

There are alternative election methods, whose purpose is to maximize global satisfaction with the result by allowing electors to also express their "second option", and third option and so on https://en.wikipedia.org/wiki/Condorcet_method .

It would be interesting to support this election method in the XPoll application, I see it as a poll type option along with "single choice" and "multiple choice" that are available today.

trrenty commented 3 years ago

Hello there

After studying the way things work with this Application, I came up with the following way of handling this issue.

For this feature we would need to keep track of the checkbox selection order. We can track this by assigning a value to each input before sending the form. When the form is handled by the XPollService, a PollVote object will be created/modified with the votes in the order or the selection. This won't affect the other ways of determining the winner of the poll.

Now that we have the preferences of each user in order, we can determine the winner using the Condorcet Method.

For the ordering part I was thinking of using a code similar to this to save the order into an array and, before saving, assigning each checkbox it's corresponding index.

Afterwards, I should make some modifications inside the XPollService, where the request is handled. Once to assign the user the votes in the proper order (here) and once to determine the winner with the new method. I was thinking of handling the latter with a simple if.

if (pollType == condorcet) {
  // determine winner using condorcet method
} else {
  // determine winner in the traditional manner
}

Wdyt?

mflorea commented 3 years ago

Hi Teodor, it's not clear to me how the user knows the order of the selected options just by looking at the check boxes. The user may know the order when they vote, but if they come back after one week they might forgot. The order needs to be clearly visible. Don't you agree?

trrenty commented 3 years ago

For the moment I was thinking that a label with a number next to the checkboxes should do the trick. But I also thought that since we have the order of their votes, we can forge the UI in whatever way we want.

mflorea commented 3 years ago

The UIX you propose is a bit cumbersome when there are multiple choices. Let's say you have 6 choices. If you know the order you want to apply then you need 6 clicks. That's fine. The problem is if you change your mind. Say for instance if you want to change your number 1 pick. You'd have to:

I think there are better UIX solutions that we could implement. One option is to use drag & drop to change the order. Another one is to use a drop down with the order (1-6) instead of a check box. My point is that we need to see what is the best way for the user to vote using the Condorcet method. I know that what you proposed integrates well with the current display of the poll, but I feel it's not the best option for the user (it may be the best option for the developer :) ). Would be good to check how other voting tools behave when the Condorcet method is used (i.e. check what others do). In the end we will probably make a compromise, but at least we would know that we didn't implement A or B because it was too costly or something else.

For the moment I was thinking that a label with a number next to the checkboxes should do the trick.

This could help visualize the order, but it doesn't fix the "problem" of editing your vote when you change your mind.

trrenty commented 3 years ago

I took a look around. I could find three main ways in which people handle ranked options.

I created some images to visualize how each of them would look inside xwiki.

The first one would be Google Form's way of handling it - a matrix in which the lines represent the hierarchy and the columns representing the proposals.

240993984_1515999025423084_3612680250271977919_n

The second option for the UI would be something Survey Monkey does and the one you mentioned - drag and dropping.

241054415_964871314294477_451845477465020275_n

And the third one, one you also mentioned, is having multiple selects instead of checkboxes. 240955230_2991923754397054_8656751123229507369_n

As you can see in the images, for viewing the votes of the other users, I used the method mentioned in my previous comment - number beside each checkbox, but we could also use different ways of displaying them, such as the drag and dropping boxes.

I personally think the drag and dropping method looks the best but I'm not sure about its complexity, the select method also looks pretty good and it's simpler. And besides the looks, they should also be really user friendly, compared to the checkboxes. The matrix method is pretty bad - imo.

What do you think?

mflorea commented 3 years ago

The matrix method is pretty bad - imo.

I agree.

I personally think the drag and dropping method looks the best but I'm not sure about its complexity, the select method also looks pretty good and it's simpler. And besides the looks, they should also be really user friendly, compared to the checkboxes.

Yes. The drag & drop solution will be a bit more complex to implement so I'd start with the drop down solution. Thus I think we should go with:

@lucaa WDYT? Does this sound good enough for a first version?

lucaa commented 3 years ago

@lucaa WDYT? Does this sound good enough for a first version?

yep, sounds good (I only got to read it now). IIUC this is what was implemented for closing this issue, right?