]> ruin.nu Git - ndwebbie.git/commitdiff
Add alliance members pscans
authorMichael Andreen <harv@ruin.nu>
Sun, 27 Jun 2021 09:23:50 +0000 (11:23 +0200)
committerMichael Andreen <harv@ruin.nu>
Sun, 27 Jun 2021 09:23:50 +0000 (11:23 +0200)
lib/NDWeb/Controller/Alliances.pm
root/src/alliances/edit.tt2
root/src/alliances/pscans.tt2 [new file with mode: 0644]

index 8f0b6c67555203131bbcb25b828e7978945eb6a8..70c6340419e077844d1f4fd531e6d9eeabc0d37d 100644 (file)
@@ -107,6 +107,23 @@ ORDER BY tick DESC, mission
        $c->stash(intel => $query->fetchall_arrayref({}) );
 }
 
+
+sub pscans : Local {
+       my ( $self, $c, $id ) = @_;
+       my $dbh = $c->model;
+
+       my $members = $dbh->prepare(q{
+               SELECT pid AS id, coords(x,y,z), metal, crystal, eonium, ps.tick
+                       ,planet_status,hit_us, sizerank, scorerank, valuerank, xprank
+               FROM current_planet_stats p left outer join current_planet_scans ps using (pid)
+               WHERE p.aid = ?
+               ORDER BY x,y,z
+               });
+       $members->execute($id);
+       $c->stash(members => $members->fetchall_arrayref({}) );
+
+}
+
 sub postallianceupdate : Local {
        my ( $self, $c, $id, $order ) = @_;
        my $dbh = $c->model;
index 609ee4c1e77ee4cc8f94d8468769bfad91fecf55..cf34eaf10c0b84ae7a7a3b3504b186048f4fb1d0 100644 (file)
@@ -25,7 +25,7 @@
 </fieldset>
 </div>
 </fieldset>
-<p>Export information <a href="[% c.uri_for('/textexport/alliance',a.id) %]">as text</a>.</p>
+<p><a href="[% c.uri_for('pscans',a.id) %]">Planet scans</a>.</p><p>Export information <a href="[% c.uri_for('/textexport/alliance',a.id) %]">as text</a>.</p>
 <div class="leftinfo">
 <img class="graph" src="[% c.uri_for('/graphs/alliancevsintel',a.id,STICK) %]" alt="Alliance size and score vs members" height="300" width="500">
 <img class="graph" src="[% c.uri_for('/graphs/avgalliancevsintel',a.id,STICK) %]" alt="Avg alliance size and score vs members" height="300" width="500">
diff --git a/root/src/alliances/pscans.tt2 b/root/src/alliances/pscans.tt2
new file mode 100644 (file)
index 0000000..8286560
--- /dev/null
@@ -0,0 +1,20 @@
+[% META title = 'Alliance P-Scans' %]
+
+<table class="stats">
+       <tr>
+               <th>Coords</th>
+               <th>Metal</th>
+               <th>Crystal</th>
+               <th>Eonium</th>
+               <th>Tick</th>
+       </tr>
+[% FOR m IN members %]
+       <tr class="[% loop.count % 2 == 0 ? 'even' : 'odd' %]">
+               <td><a href="[% c.uri_for('/stats/planet',m.id) %]">[% m.coords %]</a></td>
+               <td>[% m.metal %]</td>
+               <td>[% m.crystal %]</td>
+               <td>[% m.eonium %]</td>
+               <td>[% m.tick %]</td>
+       </tr>
+[% END %]
+</table>