[Linux-aus] Only two more days of voting!

Stewart Smith stewart at linux.org.au
Sat Jan 28 07:29:02 UTC 2006


On Thu, 2006-01-26 at 08:18 +1100, James Purser wrote:
> On Wed, 2006-01-25 at 22:26 +1100, Jonathan Oxer wrote:
> > Luckily the order of redistribution made no difference to the final
> > result but an equal vote count on the final 2+ candidates when the
> > number of remaining candidates is one greater than the number of
> > positions is a corner case that should probably be taken into account
> > if someone can figure out a nice algorithm for it.
> 
> Just a thought on the above.
> 
> Assuming your using temp tables to hold the votes for each round, grab
> the record with the lowest votes, check to see if there is more than one
> record with that number of votes. If there is more than one record, then
> dump those records and redistribute.

But "dump those records and redistribute" doesn't work if you have 4
people left, 3 positions to fill and the two lower voted people with the
same number of votes.

This is the tricky problem.

I also am not currently using temporary tables. possibly should be...
not sure if it'd help in performance. Although I'm not caring so much
about performance. I care more about correctness.

> <Hacky ugly code>
> 
> $qstring = "SELECT DISTINCT votes FROM temp_table ORDER BY votes ASC";
> $res = pg_query($qstring);
> 
> $vote_num = pg_fetch_row($res);
> $qstring = "SELECT nom, votes FROM temp_table WHERE votes =
> ".$vote_num[0];
> $res = pg_query($qstring);
> while($nom_lowest = pg_fetch_row($res))
> {
> 	redistribute($nom_lowest[0]);
> }
> 
> </Hacky ugly code>
> Something like the above should work.

patches welcome :)

-- 
Stewart Smith (stewart at linux.org.au)
Committee Member, Linux Australia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.linux.org.au/pipermail/linux-aus/attachments/20060128/13b38ac4/attachment-0001.pgp 


More information about the linux-aus mailing list