wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r18094: LJSUP-7767. incorrect election

Committer: gprochaev
LJSUP-7767. incorrect election

U   trunk/cgi-bin/LJ/Poll.pm
Modified: trunk/cgi-bin/LJ/Poll.pm
===================================================================
--- trunk/cgi-bin/LJ/Poll.pm	2011-01-24 10:20:09 UTC (rev 18093)
+++ trunk/cgi-bin/LJ/Poll.pm	2011-01-25 04:05:59 UTC (rev 18094)
@@ -795,7 +795,7 @@
     ## Max votes
     my $max_votes = $cnts[0];
     ## Check for duplicate of votes count
-    foreach my $it (keys %results) {
+    foreach my $it (sort { $b <=> $a } keys %results) {
         if (
             $max_votes == $results{$it}     ## Found max votes count
             && $max_votes_for               ## User have selected already
@@ -804,8 +804,9 @@
             ## We have two equal votes count for diff users
             $max_votes_for = undef;
             last;
+        } elsif ($max_votes == $results{$it}) {
+            $max_votes_for = $it;
         }
-        $max_votes_for = $it;
     }
 
     ## We found election winner. Set this user as supermaintainer and close election.
@@ -817,6 +818,9 @@
             LJ::set_rel($is_super, $winner->{userid}, 'S');
             $self->close_poll;
 
+            my $system = LJ::load_user('system');
+            $comm->log_event('set_owner', { actiontarget => $winner->{userid}, remote => $system });
+
             ## Poll is closed. Emailing to all maintainers about it.
             my $subject = LJ::Lang::ml('poll.election.email.subject.closed');
             my $maintainers = LJ::load_rel_user($comm->userid, 'A');

Tags: livejournal, pm, wisest-owl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments