X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;ds=sidebyside;f=raids.pl;h=3d474b59bacc19dafe8b93db3e89ead25738ea2a;hb=38ca8c5683ec02a62badb6a0150e60a9a9338580;hp=ee38de30b18e25d216a7cab9420f3f2e16394345;hpb=2b422881a5d25958c939a31a90d50e0ad2ccfdd6;p=ndwebbie.git diff --git a/raids.pl b/raids.pl index ee38de3..3d474b5 100644 --- a/raids.pl +++ b/raids.pl @@ -191,6 +191,7 @@ ORDER BY size}); while (my $target = $targetquery->fetchrow_hashref){ my %target; $target{Id} = $target->{id}; + $target{Ajax} = $ajax; my $num = pow(10,length($target->{score})-2); $target{Score} = ceil($target->{score}/$num)*$num; $num = pow(10,length($target->{value})-2); @@ -202,6 +203,31 @@ ORDER BY size}); $num = pow(10,length($target->{resvalue})-2); $target{ResValue} = floor($target->{resvalue}/$num)*$num; $target{comment} = parseMarkup($target->{comment}) if ($target->{comment}); + + my $scans = $DBH->prepare(q{SELECT DISTINCT ON (type) type, tick, scan FROM scans + WHERE planet = ? AND type ~ 'Unit|Planet|Military|.* Analysis' AND tick + 24 > tick() + GROUP BY type, tick, scan ORDER BY type ,tick DESC}); + $scans->execute($target->{planet}); + my %scans; + while (my $scan = $scans->fetchrow_hashref){ + $scans{$scan->{type}} = $scan; + } + + my @scans; + for my $type ('Planet','Unit','Military','Surface Analysis','Technology Analysis'){ + next unless exists $scans{$type}; + my $scan = $scans{$type}; + if ($ND::TICK - $scan->{tick} > 5){ + $scan->{scan} =~ s{