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

[livejournal] r18102: LJSUP-7780. Election is not finishen. Ad...

Committer: gprochaev
LJSUP-7780. Election is not finishen. Add check for max votes on prolong day.

U   trunk/cgi-bin/LJ/Poll.pm
Modified: trunk/cgi-bin/LJ/Poll.pm
===================================================================
--- trunk/cgi-bin/LJ/Poll.pm	2011-01-25 08:57:47 UTC (rev 18101)
+++ trunk/cgi-bin/LJ/Poll.pm	2011-01-25 10:02:57 UTC (rev 18102)
@@ -786,10 +786,6 @@
         $cnt++;
     }
 
-    ## Not all maintainers have voted
-    return 0
-        if @items != $cnt;
-
     my @cnts = sort { $b <=> $a } values %results;
     my $max_votes_for = 0;
     ## Max votes
@@ -809,6 +805,19 @@
         }
     }
 
+    ## We are on close date?
+    my $create = LJ::TimeUtil->mysqldate_to_time($self->prop('createdate'));
+    my $delta = time - $create;
+    ## Check for selected winner in a 3-week-end day
+    if (($delta % (21 * 86400) < 86400) && !$max_votes_for) {
+        return 0;
+    }
+    
+    ## Not all maintainers have voted and poll was prolonged
+    if ((@items != $cnt) && ($delta % (21 * 86400) > 86400)) {
+        return 0;
+    }
+
     ## We found election winner. Set this user as supermaintainer and close election.
     if ($max_votes_for && $items[$max_votes_for - 1]) {
         my $winner = $items[$max_votes_for - 1]->{item};

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