From 2beb3d43799508cd77b7f214513ac2f9e33fbc51 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 30 Aug 2009 19:42:07 +0100 Subject: [PATCH] Show total distance --- yarrg/web/routetrade | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade index 7d112b7..4885782 100644 --- a/yarrg/web/routetrade +++ b/yarrg/web/routetrade @@ -575,6 +575,7 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw( % WHERE islandid = ?'); % my %da_ages; % my $total_total= 0; +% my $total_dist= 0; %

Voyage trading plan

@@ -583,11 +584,13 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw( +- <% $this_dist |h %> leagues % } <%perl> my $age_reported= 0; @@ -695,7 +698,7 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw( } -
% $iquery->execute($islandids[$i]); % my ($islandname) = $iquery->fetchrow_array(); +% my $this_dist= $distance->($islandids[$i-1],$islandids[$i]); +% $total_dist += $this_dist; % if (!$i) { Start at <% $islandname |h %> % } else { Sail to <% $islandname |h %> -- <% $distance->($islandids[$i-1],$islandids[$i]) |h %>leagues
+Total distance: <% $total_dist %> leagues. Overall net cash flow <% $total_total < 0 ? -$total_total." loss" : $total_total." gain" -- 2.30.2