]> ruin.nu Git - ndwebbie.git/blobdiff - lib/NDWeb/Controller/Alliances.pm
Update to be compatible with newer Catalyst.
[ndwebbie.git] / lib / NDWeb / Controller / Alliances.pm
index 348884acaa1893c1b18335c37d42f8d10c79f79b..ec6da88f2d634d648549dea75564f0209b1f2c3c 100644 (file)
@@ -4,8 +4,6 @@ use strict;
 use warnings;
 use parent 'Catalyst::Controller';
 
-use NDWeb::Include;
-
 =head1 NAME
 
 NDWeb::Controller::Alliances - Catalyst Controller
@@ -95,13 +93,15 @@ sub edit : Local {
        my $ticks = $c->req->param('ticks') || 48;
        $c->stash(showticks => $ticks);
 
-       $query = $dbh->prepare(intelquery q{
-                       o.alliance AS oalliance ,coords(o.x,o.y,o.z) AS ocoords, i.sender
-                       ,t.alliance AS talliance,coords(t.x,t.y,t.z) AS tcoords, i.target
-               },q{NOT ingal AND (o.alliance = $1 OR t.alliance = $1)
-                       AND (i.mission = 'Defend' OR i.mission = 'AllyDef')
-                       AND COALESCE( t.alliance != o.alliance, TRUE)
-                       AND i.tick > (tick() - $2)
+       $query = $dbh->prepare(q{
+SELECT salliance, scoords, sender, talliance, tcoords, target
+       ,mission, tick AS landingtick, eta, amount, ingal, username
+FROM full_intel
+WHERE NOT ingal AND (salliance = $1 OR talliance = $1)
+       AND (mission = 'Defend' OR mission = 'AllyDef')
+       AND COALESCE( talliance <> salliance, TRUE)
+       AND tick > (tick() - $2)
+ORDER BY tick DESC, mission
                });
        $query->execute($a->{name}, $ticks);
        $c->stash(intel => $query->fetchall_arrayref({}) );
@@ -193,7 +193,7 @@ sub hostile : Local {
 FROM calls c 
        JOIN incomings i USING (call)
        JOIN current_planet_stats s USING (pid)
-WHERE c.landing_tick - i.eta > $1 and c.landing_tick - i.eta < $2
+WHERE c.landing_tick BETWEEN $1 + i.eta AND $2 + i.eta
 GROUP BY s.aid,s.alliance
 ORDER BY hostile_count DESC
                });