diff sheep.pl @ 142:9b8aa30a532c

counting members by ally
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Fri, 31 Oct 2008 10:53:14 +0800
parents 21df8eb17a52
children 937fc672df56
line wrap: on
line diff
--- a/sheep.pl	Fri Oct 31 10:52:52 2008 +0800
+++ b/sheep.pl	Fri Oct 31 10:53:14 2008 +0800
@@ -48,9 +48,10 @@
         # 查聯盟數量
         my $members = 1;
         unless ($sheep->allyId == '0') {
-            my $ally = $sheep->ally;
-            $members = $ally->members;
-            # Ikariam::User->search(allyId => $sheep->allyId)->count();
+            unless (!defined($sheep->allyId) || $sheep->allyId == 0) {
+                my $ally = Ikariam::Ally->retrieve($sheep->allyId);
+                $members = $ally->members;
+            }
         }
 
         foreach my $c ($sheep->cities) {
@@ -61,7 +62,7 @@
             unless($c->status eq 'i') {
                 # Ignore 聯盟人數大於五
                 # TODO 應該依照影響力來分
-                next if($members > 5);
+                next if($members > 10);
             }
 
             my $island = Ikariam::Island->retrieve($c->island);