[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Our counting procedure



Hi.

In <[🔎] 20010330162602.B715@debian.org>,
 on "Fri, 30 Mar 2001 16:26:02 -0800",
  Joseph Carter <knghtbrd@debian.org> wrote:

> 3. The software needs to be fixed.
> 5. Once they're done, the software can be fixed.
> 6. The vote software should be packaged when this is all over with - in
>    fact people should examine the debvote package and report problems they
>    see in its operation.  Now's the time to resolve this if it's gonna be
>    resolved, right?

I think the releated function is FindWinner in Rank.pm.

This uses

    foreach my $key ( keys( %DataBase ) )
    {
        my $rec = {};
        my @ballot = undef;

        $rec = $DataBase{ $key };
        @ballot = split( "",  $rec->{ 'vote' } );
        for( my $i=0; $i<$choices-1; $i++ )
        {   my $choice1 = $i+1;
            for ( my $j=$i+1; $j<$choices; $j++ )
            {   my $choice2 = $j+1;
                if ( $ballot[$i] ne '-'  and $ballot[$j] ne '-' and $i != $j ) 
                {   if ( $ballot[$i] < $ballot[$j] )
                    {   $pref{ "$choice1-$choice2" }++; }
                    else
                    {   $pref{ "$choice2-$choice1" }++; }
                } 
            }
        }
    }

so if $ballot[$i] or $ballot[$j] is '-', then the ballot is not
counted for $i and $j.

just adding some lines, for ex:

            for ( my $j=$i+1; $j<$choices; $j++ )
            {   my $choice2 = $j+1;
                if ( $ballot[$i] ne '-'  and $ballot[$j] ne '-' and $i != $j ) 
                {   if ( $ballot[$i] < $ballot[$j] )
                    {   $pref{ "$choice1-$choice2" }++; }
                    else
                    {   $pref{ "$choice2-$choice1" }++; }
+		} elsif ( $ballot[$i] ne '-' and $ballot[$j] eq '-' )
+		{   $pref{ "$choice1-$choice2" }++;
+               } elsif ( $ballot[$i] eq '-' and $ballot[$j] ne '-' )
+		{   $pref{ "$choice2-$choice1" }++;
		}
            }

might work for the current debvote, I suppose.

But I don't know if this is what our constitution describes,
and since I don't think the change severely and have not tested it
at all, so there might be some faults.

Just to provide the starting point.
-- 
  Taketoshi Sano: <sano@debian.org>,<sano@debian.or.jp>,<kgh12351@nifty.ne.jp>



Reply to: