]> ruin.nu Git - ndwebbie.git/blobdiff - NDWeb/Pages/EditRaid.pm
Only count fleets from launch confirmation
[ndwebbie.git] / NDWeb / Pages / EditRaid.pm
index e701f1d2d418492ee9912fd9e05dc4d88c2e1968..5638b4f57dcdae37656756f516eaa6ba6f150995 100644 (file)
 #   Free Software Foundation, Inc.,                                       *
 #   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 #**************************************************************************/
-package ND::Web::Pages::EditRaid;
+package NDWeb::Pages::EditRaid;
 use strict;
 use warnings FATAL => 'all';
 use ND::Include;
 use CGI qw/:standard/;
-use ND::Web::Include;
+use NDWeb::Include;
 
-use base qw/ND::Web::XMLPage/;
+use base qw/NDWeb::XMLPage/;
 
-$ND::Web::Page::PAGES{editRaid} = __PACKAGE__;
+$NDWeb::Page::PAGES{editRaid} = __PACKAGE__;
 
 sub render_body {
        my $self = shift;
@@ -223,28 +223,15 @@ sub render_body {
                        }
                        $target->{waves} = \@waves;
 
-                       my $scans = $DBH->prepare(q{SELECT DISTINCT ON (type) type, tick, scan FROM scans 
-                               WHERE planet = ? AND type ~ 'Unit|Planet|Advanced Unit|.* Analysis' AND tick + 24 > tick() AND scan is not null
-                               GROUP BY type, tick, scan ORDER BY type ,tick DESC});
+                       my $scans = $DBH->prepare(q{SELECT DISTINCT ON (type) scan_id,type, tick FROM scans 
+                               WHERE planet = ? AND type ~ 'Unit|Planet|Advanced Unit|.* Analysis' AND tick + 24 > tick()
+                               ORDER BY type ,tick DESC});
                        $scans->execute($target->{planet});
                        delete $target->{planet};
-                       my %scans;
-                       while (my $scan = $scans->fetchrow_hashref){
-                               $scans{$scan->{type}} = $scan;
-                       }
 
                        my @scans;
-                       for my $type ('Planet','Unit','Advanced Unit','Surface Analysis','Technology Analysis'){
-                               next unless exists $scans{$type};
-                               my $scan = $scans{$type};
-                               if ($self->{TICK} - $scan->{tick} > 5){
-                                       $scan->{scan} =~ s{<table( cellpadding="\d+")?>}{<table class="old">};
-                               }
-                               if ($type eq 'Planet'){
-                                       $target->{PlanetScan} = $scan->{scan};
-                                       next;
-                               }
-                               push @scans,{Scan => $scan->{scan}};
+                       while (my $scan = $scans->fetchrow_hashref){
+                               push @scans,$scan;
                        }
                        $target->{Scans} = \@scans;
                        push @targets,$target;