chiark / gitweb /
Another todo list item
[ypp-sc-tools.db-test.git] / yarrg / web / routetrade
index 7d112b730ae480e938db46648d28038d4b1cf443..4885782e58a440b7a773510a049daf363e5e0838 100644 (file)
@@ -575,6 +575,7 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
 %                              WHERE islandid = ?');
 % my %da_ages;
 % my $total_total= 0;
+% my $total_dist= 0;
 %
 <h1>Voyage trading plan</h1>
 <table rules=groups>
@@ -583,11 +584,13 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
 <tr><td colspan=3>
 %      $iquery->execute($islandids[$i]);
 %      my ($islandname) = $iquery->fetchrow_array();
+%      my $this_dist= $distance->($islandids[$i-1],$islandids[$i]);
+%      $total_dist += $this_dist;
 %      if (!$i) {
 <strong>Start at <% $islandname |h %></strong>
 %      } else {
 <strong>Sail to <% $islandname |h %></strong>
-- <% $distance->($islandids[$i-1],$islandids[$i]) |h %>leagues </td>
+- <% $this_dist |h %> leagues </td>
 %      }
 <%perl>
      my $age_reported= 0;
@@ -695,7 +698,7 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw(
 }
 </%perl>
 <tbody><tr>
-<td colspan=2>
+<td colspan=2>Total distance: <% $total_dist %> leagues.
 <td colspan=3 align=right>Overall net cash flow
 <td align=right><strong><%
   $total_total < 0 ? -$total_total." loss" : $total_total." gain"