X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=lib%2FNDWeb%2FController%2FIntel.pm;h=55f6643ee057f789e51746bff47427703bc32f15;hb=a4b209407c81ec7b71c9c7f8c4d57bb2f77256f4;hp=46fe6ce79deaa147f0e326e6904489c5e2a5d69e;hpb=5ca7cefbaab2deaccacbfd69ce23065034c07732;p=ndwebbie.git diff --git a/lib/NDWeb/Controller/Intel.pm b/lib/NDWeb/Controller/Intel.pm index 46fe6ce..55f6643 100644 --- a/lib/NDWeb/Controller/Intel.pm +++ b/lib/NDWeb/Controller/Intel.pm @@ -281,6 +281,26 @@ sub member : Local { $c->stash(defenses => \@defenses); } +sub naps : Local { + my ( $self, $c ) = @_; + my $dbh = $c->model; + + my $query = $dbh->prepare(q{SELECT p.id,coords(x,y,z) + ,ruler, p.planet,race, size, score, value + , xp, sizerank, scorerank, valuerank, xprank, p.value - p.size*200 + - COALESCE(ps.metal+ps.crystal+ps.eonium,0)/150 + - COALESCE(ds.total ,(SELECT COALESCE(avg(total),0) + FROM current_development_scans)::int)*1500 AS fleetvalue + ,(metal+crystal+eonium)/100 AS resvalue, planet_status,hit_us + , alliance,relationship,nick + FROM current_planet_stats p + LEFT OUTER JOIN current_planet_scans ps ON p.id = ps.planet + LEFT OUTER JOIN current_development_scans ds ON p.id = ds.planet + WHERE planet_status IN ('Friendly','NAP') order by x,y,z asc + }); + $query->execute; + $c->stash(planets => $query->fetchall_arrayref({}) ); +} =head1 AUTHOR