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

[livejournal] r17639: LJSUP-7052. We do not random comms if it...

Committer: gprochaev
LJSUP-7052. We do not random comms if its too few.

U   trunk/cgi-bin/LJ/Vertical.pm
Modified: trunk/cgi-bin/LJ/Vertical.pm
===================================================================
--- trunk/cgi-bin/LJ/Vertical.pm	2010-11-03 10:38:21 UTC (rev 17638)
+++ trunk/cgi-bin/LJ/Vertical.pm	2010-11-03 10:43:30 UTC (rev 17639)
@@ -641,10 +641,13 @@
     return [] unless $comms;
     my $max_num = scalar @$comms;
     my $count   = $args{'count'};
-    $count = $max_num if $count > $max_num;
+    if ($count > $max_num) {
+        $count = $max_num;
+        $is_random = 0;
+    }
     my @result = ();
     while ($count--) {
-        my $comm = $comms->[int(rand($max_num))];
+        my $comm = $is_random ? $comms->[int(rand($max_num))] : $comms->[$count];
         push @result, $comm if $comm;
     }
 

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