X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=NDWeb%2FPages%2FMemberIntel.pm;h=292d985d54afb27f92665befca4fcf2f11d6ac40;hb=57f880656c4486f68583058121a5bcb3b316199c;hp=36eb09a65a23eeaf524afba812867ffeb585e379;hpb=714846d8dc9f1302a758767c208934b04085a9ce;p=ndwebbie.git diff --git a/NDWeb/Pages/MemberIntel.pm b/NDWeb/Pages/MemberIntel.pm index 36eb09a..292d985 100644 --- a/NDWeb/Pages/MemberIntel.pm +++ b/NDWeb/Pages/MemberIntel.pm @@ -57,7 +57,7 @@ sub render_body { my $query = $DBH->prepare(q{ SELECT coords(t.x,t.y,t.z), i.eta, i.tick, rt.id AS ndtarget, rc.launched, inc.landing_tick FROM users u - LEFT OUTER JOIN (SELECT DISTINCT * FROM fleets WHERE amount = -1) i ON i.sender = u.planet + LEFT OUTER JOIN (SELECT DISTINCT eta,tick,sender,target,mission,name FROM fleets WHERE amount IS NULL) i ON i.sender = u.planet LEFT OUTER JOIN current_planet_stats t ON i.target = t.id LEFT OUTER JOIN (SELECT rt.id,planet,tick FROM raids r JOIN raid_targets rt ON r.id = rt.raid) rt ON rt.planet = i.target @@ -73,8 +73,6 @@ sub render_body { $query->execute($user->{uid}) or $error .= $DBH->errstr; my @nd_attacks; my @other_attacks; - my $ndi = 0; - my $oi = 0; while (my $intel = $query->fetchrow_hashref){ my $attack = {target => $intel->{coords}, tick => $intel->{tick}}; if ($intel->{ndtarget}){ @@ -83,10 +81,8 @@ sub render_body { }else{ $attack->{Other} = 'Launched at a tick that was not claimed'; } - $attack->{ODD} = ++$ndi % 2; push @nd_attacks, $attack; }else{ - $attack->{ODD} = ++$oi % 2; push @other_attacks, $attack; } } @@ -98,7 +94,7 @@ sub render_body { $query = $DBH->prepare(q{ SELECT coords(t.x,t.y,t.z),t.alliance_id, t.alliance, i.eta, i.tick, i.ingal FROM users u - JOIN (SELECT DISTINCT * FROM fleets WHERE amount = -1) i ON i.sender = u.planet + JOIN (SELECT DISTINCT name,eta,tick,sender,target,mission,ingal FROM fleets WHERE amount IS NULL) i ON i.sender = u.planet LEFT OUTER JOIN current_planet_stats t ON i.target = t.id WHERE u.uid = $1 AND (i.mission = 'Defend' OR i.mission = 'AllyDef') ORDER BY (i.tick - i.eta) @@ -107,19 +103,13 @@ sub render_body { my @nd_def; my @ingal_def; my @other_def; - $ndi = 0; - $oi = 0; - my $gi = 0; while (my $intel = $query->fetchrow_hashref){ my $def = {target => $intel->{coords}.(defined $intel->{alliance} ? " ($intel->{alliance})" : ''), tick => $intel->{tick}}; if (defined $intel->{alliance_id} && $intel->{alliance_id} == 1){ - $def->{ODD} = ++$ndi % 2; push @nd_def, $def; }elsif($intel->{ingal}){ - $def->{ODD} = ++$gi % 2; push @ingal_def, $def; }else{ - $def->{ODD} = ++$oi % 2; push @other_def, $def; } } @@ -143,7 +133,7 @@ sub render_body { FROM users u JOIN groupmembers gm USING (uid) LEFT OUTER JOIN (SELECT DISTINCT ON (planet) planet,tick from scans where type = 'News' ORDER BY planet,tick DESC) n USING (planet) - LEFT OUTER JOIN (SELECT DISTINCT * FROM fleets WHERE amount = -1) i ON i.sender = u.planet + LEFT OUTER JOIN (SELECT DISTINCT name,eta,tick,sender,target,mission,ingal FROM fleets WHERE amount IS NULL) i ON i.sender = u.planet LEFT OUTER JOIN current_planet_stats t ON i.target = t.id LEFT OUTER JOIN (SELECT rt.id,planet,tick FROM raids r JOIN raid_targets rt ON r.id = rt.raid) rt ON rt.planet = i.target @@ -154,10 +144,7 @@ sub render_body { ORDER BY $order DESC}); $query->execute() or $error .= $DBH->errstr; my @members; - my $i = 0; while (my $intel = $query->fetchrow_hashref){ - $i++; - $intel->{ODD} = $i % 2; $intel->{OLD} = 'OLD' if (!defined $intel->{tick} || $self->{TICK} > $intel->{tick} + 60); delete $intel->{tick}; push @members,$intel;