X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=lib%2FNDWeb%2FController%2FCovOp.pm;h=d114726bd440525899d205ad9e62fefe25b751c7;hb=a23c68aad4c5eb92a61f46517daf474c1741c1e5;hp=68ef8a8059533cf6546fd59c847ecaf04dda2cb2;hpb=80ad5ca3ad49aa9cc029fe3baaff513e422ef499;p=ndwebbie.git diff --git a/lib/NDWeb/Controller/CovOp.pm b/lib/NDWeb/Controller/CovOp.pm index 68ef8a8..d114726 100644 --- a/lib/NDWeb/Controller/CovOp.pm +++ b/lib/NDWeb/Controller/CovOp.pm @@ -25,41 +25,43 @@ sub index :Path :Args(0) { my ( $self, $c ) = @_; $c->stash( where => q{AND MaxResHack > 130000 ORDER BY minalert ASC,MaxResHack DESC}); + $c->forward('list'); } sub distwhores : Local { my ( $self, $c ) = @_; $c->stash( where => qq{AND distorters > 0 ORDER BY distorters DESC, minalert ASC}); + $c->forward('list'); } sub marktarget : Local { my ( $self, $c, $target ) = @_; my $dbh = $c->model; - my $update = $dbh->prepare(q{INSERT INTO covop_attacks (uid,id,tick) VALUES(?,?,tick())}); - $update->execute($c->user->id,$target); - - $c->res->redirect($c->req->referer); + eval{ + $update->execute($c->user->id,$target); + }; + $c->forward('/redirect'); } -sub end : Private { +sub list : Private { my ( $self, $c ) = @_; my $dbh = $c->model; my $query = $dbh->prepare(q{SELECT id, coords, metal, crystal, eonium - , covop_alert(seccents,structures,gov,0) AS minalert - , covop_alert(seccents,structures,gov,50) AS maxalert - , distorters,gov + , covop_alert(seccents,structures,size,guards,gov,0) AS minalert + , covop_alert(seccents,structures,size,guards,gov,50) AS maxalert + , distorters,gov,pstick,dstick , MaxResHack,co.tick AS lastcovop - FROM (SELECT p.id,coords(x,y,z), metal,crystal,eonium, - seccents,NULLIF(ss.total::integer,0) AS structures,distorters + FROM (SELECT p.id,coords(x,y,z),size, metal,crystal,eonium,guards + ,seccents,NULLIF(ds.total::integer,0) AS structures,distorters ,max_bank_hack(metal,crystal,eonium,p.value ,(SELECT value FROM current_planet_stats WHERE id = ?)) AS MaxResHack - , planet_status, relationship,gov + , planet_status, relationship,gov,ps.tick AS pstick, ds.tick AS dstick FROM current_planet_stats p - LEFT OUTER JOIN planet_scans ps ON p.id = ps.planet - LEFT OUTER JOIN structure_scans ss ON p.id = ss.planet + LEFT OUTER JOIN current_planet_scans ps ON p.id = ps.planet + LEFT OUTER JOIN current_development_scans ds ON p.id = ds.planet ) AS foo LEFT OUTER JOIN (SELECT id,max(tick) AS tick FROM covop_attacks GROUP BY id) co USING (id) WHERE (metal IS NOT NULL OR seccents IS NOT NULL) @@ -75,7 +77,6 @@ sub end : Private { $c->stash(targets => \@targets); $c->stash(template => 'covop/index.tt2'); - $c->forward('/end'); } =head1 AUTHOR