fairvotereform / RankIt

https://rankit.vote
1 stars 2 forks source link

Votes disappear after an election #158

Closed ggordn3r closed 3 years ago

ggordn3r commented 3 years ago

Many users have reported that the first 1-2 votes don't appear. I've reproduced the bug here: https://rankit.skelpo.com/results/ieXixApNbCyecLYdHP3Z/summary

It looks like it happens when the number of votes is less than the number of winners. Can you estimate the LOE on each of the following potential fixes?

A) Hide results behind a message like "There aren't enough votes in this poll yet to declare all winners." until # of votes > # of winners. B) Show incomplete results and ignore any extra seat(s): "A wins." C) Show incomplete results with an explanation like "A wins and 1 seat is left empty."

The following may be the same bug or a different one:

If this is different, let me know and I'll split it out. After a winner is declared, the votes disappear from the count. Because of that, surplus votes aren't being visibly redistributed as expected either.

For example, California wins this poll in Round 1 and Arizona in Round 6, but neither have a bar in the Summary view: https://rankit.skelpo.com/results/eaub53HYQM70lX5J8az7/summary

The winner should retain votes equal to the threshold and the vote count should remain equal in every round.

This seems to happen intermittently. A different poll, created around the same time, works as expected: https://rankit.skelpo.com/results/0iPneO1fmLcJA4Zq6YnN/summary

The first report of this bug was on the live version on Tuesday, August 18, at 2:50 PM. Not sure if that helps narrow it down (related to fix for #154 maybe?). It was this poll, although now it has enough votes that the results are visible: https://rankit.vote/vote/LTi3w4SGNjWtQGvTHHcq

proggeramlug commented 3 years ago

Okay, the problem was/is: The algorithm will repeat the process of finding winners as long as there are winners left to be declared. The problem with this is if we have fewer votes than winners that this will never happen, and so the process times out.

Solution for the algo: Reduce number of winners to the number of votes if needed.

Solution for the frontend: Show warning. We do show this already but because the results object wasn't present it errored out. Check it out now: https://rankit.skelpo.com/results/ieXixApNbCyecLYdHP3Z/summary

ggordn3r commented 3 years ago

Ok, that looks good. Can you take a look at the other bug I mention in this issue?

proggeramlug commented 3 years ago

OKay, I fixed this - I took a bit more of an aggressive path - make sure to test this with some normal other polls as well ;)

ggordn3r commented 3 years ago

Something odd is happening with the colors. Blue is the color for elected choices. Expected behavior on /summary is that the bars for winners are all the color blue. Instead, they are gray: https://rankit.skelpo.com/results/eaub53HYQM70lX5J8az7/summary

Also, all bars are blue from Round 1 on. Expected behavior is that the bars for choices that are neither elected or eliminated are gray: https://rankit.skelpo.com/results/eaub53HYQM70lX5J8az7/1

proggeramlug commented 3 years ago

Fixed now!