$target{comment} = parseMarkup($target->{comment}) if ($target->{comment});
my $unitscans = $DBH->prepare(q{
- SELECT i.id,i.name, i.tick, i.amount
+ SELECT DISTINCT ON (name) i.id,i.name, i.tick, i.amount
FROM fleets i
WHERE i.uid = -1
AND i.sender = ?
AND i.mission = 'Full fleet'
GROUP BY i.id,i.tick,i.name,i.amount
- ORDER BY i.tick,name
+ ORDER BY name,i.tick DESC
});
$unitscans->execute($target->{planet}) or warn $DBH->errstr;
my $ships = $DBH->prepare(q{SELECT ship,amount FROM fleet_ships WHERE id = ?});
my @missions;
- my $i = 0;
while (my $mission = $unitscans->fetchrow_hashref){
- $mission->{ODD} = $i++ % 2;
my @ships;
$ships->execute($mission->{id});
my $j = 0;
push @ships, {ship => 'No', amount => 'ships'} if @ships == 0;
$mission->{ships} = \@ships;
$mission->{amount} =~ s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1,/g; #Add comma for ever 3 digits, i.e. 1000 => 1,000
+ delete $mission->{id};
push @missions,$mission;
}
$target{missions} = \@missions;
<table>
<tr><th></th><th>Metal</th><th>Crystal</th><th>Eonium</th></tr>
<tr align="center">
- <td>Roids</td>
+ <th>Roids</th>
<td><TMPL_VAR NAME=roidMetal></td>
<td><TMPL_VAR NAME=roidCrystal></td>
<td><TMPL_VAR NAME=roidEonium></td>
</tr>
<tr align="center">
- <td>Resources</td>
+ <th>Resources</th>
<td><TMPL_VAR NAME=resourceMetal></td>
<td><TMPL_VAR NAME=resourceCrystal></td>
<td><TMPL_VAR NAME=resourceEonium></td>
</tr>
</table>
</div>
- <div class="leftinfo">
-<table>
- <tr><th>Name</th><th>Tick</th><th>Amount</th></tr>
<TMPL_LOOP Missions>
- <tr align="center" class="<TMPL_IF ODD>odd<TMPL_ELSE>even</TMPL_IF>" onclick="toggleVisibility('fleet<TMPL_VAR NAME=Id>')">
- <td><TMPL_VAR NAME=Name></td>
- <td><TMPL_VAR NAME=Tick></td>
- <td><TMPL_VAR NAME=Amount></td>
- </tr>
- <tr id="fleet<TMPL_VAR NAME=Id>" style="z-index:1; display:none;">
- <td/>
- <td colspan="5"><table>
+ <div class="leftinfo">
+
+ <p><TMPL_VAR NAME=Name><br/>
+ Tick: <TMPL_VAR NAME=Tick><br/>
+ Ships:<TMPL_VAR NAME=Amount>
+ </p>
+ <table>
<TMPL_LOOP Ships>
<tr class="<TMPL_IF ODD>odd<TMPL_ELSE>even</TMPL_IF>">
<td><TMPL_VAR NAME=Ship></td><td><TMPL_VAR NAME=Amount></td>
</tr>
</TMPL_LOOP>
- </table></td>
- </tr>
- </TMPL_LOOP>
-</table>
+ </table>
</div>
+ </TMPL_LOOP>
<div class="clear"> </div>
<form action="<TMPL_VAR NAME=PAGE>" method="post">
<p class="claimlinks">