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