chiark / gitweb /
Calculate total distance correctly
[ypp-sc-tools.web-live.git] / yarrg / web / routetrade
index 482c13a3e9969e98e51afab2e8a8878be03bfeb3..7f7d27f45d26d51a25c20b42ff66003e60d6848a 100644 (file)
@@ -597,11 +597,11 @@ $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 {
+%              my $this_dist= $distance->($islandids[$i-1],$islandids[$i]);
+%              $total_dist += $this_dist;
 <strong>Sail to <% $islandname |h %></strong>
 - <% $this_dist |h %> leagues </td>
 %      }