]> ruin.nu Git - ndwebbie.git/blobdiff - ND/Web/Pages/Alliances.pm
0 members is really 0
[ndwebbie.git] / ND / Web / Pages / Alliances.pm
index aec9ea4a1cf5de17249d5add64fcc6028bdc9016..f9b830fc1c58a10c0a416a25a36a1e4dddb804dc 100644 (file)
@@ -24,23 +24,18 @@ use ND::Include;
 use CGI qw/:standard/;
 use ND::Web::Include;
 
-$ND::PAGES{alliances} = {parse => \&parse, process => \&process, render=> \&render};
+use base qw/ND::Web::XMLPage/;
 
-sub parse {
-       my ($uri) = @_;
-}
-
-sub process {
+$ND::Web::Page::PAGES{alliances} = __PACKAGE__;
 
-}
-
-sub render {
-       my ($DBH,$BODY) = @_;
+sub render_body {
+       my $self = shift;
+       my ($BODY) = @_;
+       $self->{TITLE} = 'Alliances';
+       my $DBH = $self->{DBH};
        my $error;
 
-       $ND::TEMPLATE->param(TITLE => 'Alliances');
-
-       return $ND::NOACCESS unless isHC();
+       return $self->noAccess unless $self->isHC;
 
        my $alliance;
        if (defined param('alliance') && param('alliance') =~ /^(\d+)$/){
@@ -135,7 +130,7 @@ sub render {
                        $order = "$1 DESC";
                }
                my $query = $DBH->prepare(qq{
-                       SELECT DISTINCT a.id,name,COALESCE(s.score,SUM(p.score)) AS score,COALESCE(s.size,SUM(p.size)) AS size,s.members,count(*) AS kmem,
+                       SELECT DISTINCT a.id,name,COALESCE(s.score,SUM(p.score)) AS score,COALESCE(s.size,SUM(p.size)) AS size,s.members,count(p.score) AS kmem,
                        COALESCE(SUM(p.score),-1) AS kscore, COALESCE(SUM(p.size),-1) AS ksize, COALESCE(SUM(p.xp),-1) AS kxp,COALESCE(SUM(p.value),-1) AS kvalue,
                        COALESCE(s.score/LEAST(s.members,60),-1) AS scavg, COALESCE(AVG(p.score)::int,-1) AS kscavg, COALESCE(s.size/s.members,-1) AS siavg,
                        COALESCE(AVG(p.size)::int,-1) AS ksiavg, COALESCE(AVG(p.xp)::int,-1) AS kxpavg, COALESCE(AVG(p.value)::int,-1) AS kvalavg