]> ruin.nu Git - ndwebbie.git/commitdiff
Tweaked covop sorting and output
authorMichael Andreen <harv@ruin.nu>
Thu, 12 Mar 2009 19:58:59 +0000 (20:58 +0100)
committerMichael Andreen <harv@ruin.nu>
Thu, 12 Mar 2009 19:58:59 +0000 (20:58 +0100)
lib/NDWeb/Controller/CovOp.pm
root/src/covop/index.tt2

index 1c2a3a4ecff024e057979be05e6e5f80900f8b08..b4e71fe67319f0b98eb9e65b9788c81bf16a5a5b 100644 (file)
@@ -23,18 +23,19 @@ Catalyst Controller.
 
 sub index :Path :Args(0) {
        my ( $self, $c ) = @_;
-       $c->stash( where => q{hack5 > 60000
-               ORDER BY hack5 DESC, hack15 DESC, minalert
-                       ,lastcovop NULLS FIRST,pstick DESC, dstick DESC,x,y,z
+       $c->stash( where => q{hack5 > 60000 AND minalert < 60
+               ORDER BY hack5 DESC, hack13 DESC
+                       ,(CASE WHEN tick() - lastcovop < 6 THEN lastcovop ELSE NULL END) NULLS FIRST
+                       ,minalert, pstick DESC, dstick DESC,x,y,z
                });
        $c->forward('list');
 }
 
 sub easy : Local {
        my ( $self, $c ) = @_;
-       $c->stash( where =>  q{minalert < 70
-               ORDER BY minalert, max_bank_hack DESC, hack5 DESC, hack15 DESC
-                       ,lastcovop NULLS FIRST,pstick DESC, dstick DESC,x,y,z
+       $c->stash( where =>  q{minalert < 60
+               ORDER BY minalert, hack5 DESC,lastcovop NULLS FIRST
+                       ,hack13 DESC,pstick DESC, dstick DESC,x,y,z
                });
        $c->forward('list');
 }
@@ -65,9 +66,9 @@ sub list : Private {
        my $query = $dbh->prepare(q{
        SELECT * FROM (
                SELECT *
-                       ,max_bank_hack(500000,500000,500000,pvalue,cvalue,5)
+                       ,(2*pvalue::float/cvalue) :: Numeric(3,1) AS max_bank_hack
                        ,max_bank_hack(metal,crystal,eonium,pvalue,cvalue,5) AS hack5
-                       ,max_bank_hack(metal,crystal,eonium,pvalue,cvalue,13) AS hack15
+                       ,max_bank_hack(metal,crystal,eonium,pvalue,cvalue,13) AS hack13
                FROM (SELECT p.id,coords(x,y,z),x,y,z,size
                        ,metal + metal_roids * (tick()-ps.tick) * 125 AS metal
                        ,crystal + crystal_roids * (tick()-ps.tick) * 125 AS crystal
index d0fd401d3d280d73825f67e4cbc3870aab3e750b..d6ded602fe5d56c4ebe48d36fe961d0a61262d36 100644 (file)
@@ -15,7 +15,7 @@
        <tr>
                <th>Coords</th><th>Tick</th><th>Metal</th><th>Crystal</th><th>Eonium</th>
                <th>Gov</th><th>Alert</th><th>Tick</th><th>Dists</th>
-               <th>Max (5 agents)</th><th>(15 agents)</th><th>Max</th><th>Last covop (tick)</th>
+               <th>Max (5 agents)</th><th>(13 agents)</th><th>Max</th><th>Last covop (tick)</th>
        </tr>
 
 [% debug(targets.size) %]
@@ -31,7 +31,7 @@
        <td[% PROCESS style tick=t.dstick%]>[% t.dstick %]</td>
        <td>[% t.distorters %]</td>
        <td>[% t.hack5 %]</td>
-       <td>[% t.hack15 %]</td>
+       <td>[% t.hack13 %]</td>
        <td>[% t.max_bank_hack %]</td>
        <td>[% t.lastcovop %]</td>
        <td><a href="[% c.uri_for('marktarget', t.id) %]">Did CovOp this tick</a></td>