From ddce30bcd0e77f6e923788cb7b21ada5c5ec7ce9 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Sat, 21 Apr 2007 09:52:27 +0000 Subject: [PATCH] show raid launches --- ND/Web/Pages/Points.pm | 13 +++++++++---- templates/points.tmpl | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ND/Web/Pages/Points.pm b/ND/Web/Pages/Points.pm index 2202a41..04c17dd 100644 --- a/ND/Web/Pages/Points.pm +++ b/ND/Web/Pages/Points.pm @@ -37,7 +37,7 @@ sub render_body { return $self->noAccess unless $self->isMember; my $type = "total"; - if (defined param('type') && param('type') =~ /^(defense|attack|total|humor|scan|rank)$/){ + if (defined param('type') && param('type') =~ /^(defense|attack|total|humor|scan|rank|raid)$/){ $type = $1; } $type .= '_points' unless ($type eq 'rank'); @@ -48,14 +48,19 @@ sub render_body { my $limit = 'LIMIT 10'; $limit = '' if $self->isHC; - my $query = $DBH->prepare("SELECT username,defense_points,attack_points,scan_points,humor_points, (attack_points+defense_points+scan_points/20) as total_points, rank FROM users WHERE uid IN (SELECT uid FROM groupmembers WHERE gid = 2) ORDER BY $type $order $limit"); + my $query = $DBH->prepare(qq{SELECT username,defense_points,attack_points,scan_points,humor_points + ,(attack_points+defense_points+scan_points/20) as total_points, rank, count(NULLIF(rc.launched,FALSE)) AS raid_points + FROM users u LEFT OUTER JOIN raid_claims rc USING (uid) + WHERE uid IN (SELECT uid FROM groupmembers WHERE gid = 2) + GROUP BY username,defense_points,attack_points,scan_points,humor_points,rank + ORDER BY $type $order $limit}); $query->execute; my @members; my $i = 0; - while (my ($username,$defense,$attack,$scan,$humor,$total,$rank) = $query->fetchrow){ + while (my ($username,$defense,$attack,$scan,$humor,$total,$rank,$raid) = $query->fetchrow){ $i++; - push @members,{Username => $username, Defense => $defense, Attack => $attack + push @members,{Username => $username, Defense => $defense, Attack => $attack, Raid => $raid , Scan => $scan, Humor => $humor, Total => $total, Rank => $rank, ODD => $i % 2}; } $BODY->param(Members => \@members); diff --git a/templates/points.tmpl b/templates/points.tmpl index 33dc852..7b3484a 100644 --- a/templates/points.tmpl +++ b/templates/points.tmpl @@ -4,6 +4,7 @@ Total Defenses Attacks + Raid Scans Humor ND Rank @@ -14,6 +15,7 @@ + -- 2.39.2