]> ruin.nu Git - ndwebbie.git/commitdiff
raid page updated
authorMichael Andreen <harv@ruin.nu>
Wed, 9 Jan 2008 12:38:00 +0000 (13:38 +0100)
committerMichael Andreen <harv@ruin.nu>
Wed, 9 Jan 2008 12:38:00 +0000 (13:38 +0100)
NDWeb/Pages/Raids.pm
templates/raids.tmpl

index 766d5a390e589e69202caded65c6527de2688ab1..3fb41458751caa7371a37127e46fc87a9567b4f4 100644 (file)
@@ -236,20 +236,18 @@ sub render_body {
                        $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;
@@ -260,6 +258,7 @@ sub render_body {
                                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;
index e5c1f4a373e3ba63632f23e243b3ffbd9d42849c..af9bc30efb16e0d508a0dc2f7b2f6d0bc7b858ad 100644 (file)
        <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"> &nbsp;</div>
        <form action="<TMPL_VAR NAME=PAGE>" method="post">
        <p class="claimlinks">