X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=ND%2FWeb%2FPages%2FCheck.pm;h=394c8b02ee95c8061a8688a81b3a84c4edbabcb8;hb=f6cfe40e6a8da61229131a2d38a2535ae66da359;hp=832eeb9b6d21c4dde9944682a46f9b928ab0f357;hpb=c58e53cf25bbd2ecf5e3cff6a4545aee1dfd1e51;p=ndwebbie.git diff --git a/ND/Web/Pages/Check.pm b/ND/Web/Pages/Check.pm index 832eeb9..394c8b0 100644 --- a/ND/Web/Pages/Check.pm +++ b/ND/Web/Pages/Check.pm @@ -104,14 +104,15 @@ sub render_body { while (my $planet = $query->fetchrow_hashref){ $planet_id = $planet->{id}; for my $type (qw/size score value xp/){ - #$planet->{$type} = prettyValue($planet->{$type}); - $planet->{$type} =~ s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1,/g; #Add comma for ever 3 digits, i.e. 1000 => 1,000 $planet->{"${type}img"} = 'stay'; $planet->{"${type}img"} = 'up' if $planet->{"${type}_gain_day"} > 0; $planet->{"${type}img"} = 'down' if $planet->{"${type}_gain_day"} < 0; $planet->{"${type}rankimg"} = 'stay'; $planet->{"${type}rankimg"} = 'up' if $planet->{"${type}rank_gain_day"} < 0; $planet->{"${type}rankimg"} = 'down' if $planet->{"${type}rank_gain_day"} > 0; + for my $type ($type,"${type}_gain","${type}_gain_day"){ + $planet->{$type} =~ s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1,/g; #Add comma for ever 3 digits, i.e. 1000 => 1,000 + } } if ($self->isMember && ($self->isOfficer || $self->isBC)){ if ($z && $planet->{alliance} eq 'NewDawn' && not ($self->isHC || $self->isOfficer)){ @@ -165,6 +166,14 @@ sub render_body { $scan .= q{}; push @scans, {Scan => $scan}; + $query = $DBH->prepare(q{SELECT DISTINCT ON (type) type,scan_id, tick, scan FROM scans WHERE planet = ? + GROUP BY type,scan_id, tick, scan ORDER BY type,tick DESC}); + $query->execute($planet_id); + my %scans; + while (my($type,$scan_id,$tick,$scan) = $query->fetchrow){ + $scans{$type} = [$scan_id,$tick,$scan]; + } + $query = $DBH->prepare(q{SELECT x,y,z,tick FROM planet_stats WHERE id = ? ORDER BY tick ASC}); $scan = q{

Previous Coords

@@ -180,16 +189,10 @@ sub render_body { } } $scan .= q{}; + $scan .= $scans{'Ship Classes'}->[2] if $scans{'Ship Classes'}; push @scans, {Scan => $scan}; - $query = $DBH->prepare(q{SELECT DISTINCT ON (type) type,scan_id, tick, scan FROM scans WHERE planet = ? - GROUP BY type,scan_id, tick, scan ORDER BY type,tick DESC}); - $query->execute($planet_id); - my %scans; - while (my($type,$scan_id,$tick,$scan) = $query->fetchrow){ - $scans{$type} = [$scan_id,$tick,$scan]; - } - for my $type ('Planet','Jumpgate','Unit','Military','Fleet Analysis','Surface Analysis','Technology Analysis','News'){ + for my $type ('Planet','Jumpgate','Unit','Advanced Unit','Surface Analysis','Technology Analysis','Fleet Analysis','News'){ next unless exists $scans{$type}; my $scan_id = $scans{$type}->[0]; my $tick = $scans{$type}->[1];