X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=NDWeb%2FPages%2FEditRaid.pm;h=5638b4f57dcdae37656756f516eaa6ba6f150995;hb=c26dd7395127b35eef6f219f23ebd6ffc453c2dc;hp=e701f1d2d418492ee9912fd9e05dc4d88c2e1968;hpb=d6c9085e748c4d61901aaea72f0e1546dcc7cdda;p=ndwebbie.git diff --git a/NDWeb/Pages/EditRaid.pm b/NDWeb/Pages/EditRaid.pm index e701f1d..5638b4f 100644 --- a/NDWeb/Pages/EditRaid.pm +++ b/NDWeb/Pages/EditRaid.pm @@ -16,16 +16,16 @@ # 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{}{}; - } - 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;