From 7f235a4d62c9e1c0d042a65542ff49fb121429cc Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 22 Nov 2009 14:18:29 +0000 Subject: [PATCH] Print sensible error if all trades deselected. --- yarrg/web/routetrade | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade index 1b7c8c9..21f4711 100644 --- a/yarrg/web/routetrade +++ b/yarrg/web/routetrade @@ -292,6 +292,8 @@ my $oppo_key= sub { return join '_', map { $f->{$_} } qw(org_id dst_id commodid); }; +my $any_previous_suppression= 0; + foreach my $f (@flows) { $f->{MaxQty}= $f->{'org_qty_agg'} < $f->{'dst_qty_agg'} @@ -390,6 +392,7 @@ foreach my $f (@flows) { } } else { if (!defined $qa->{"T$f->{UidShort}"}) { + $any_previous_suppression= 1; $f->{Suppress}= 1; } } @@ -413,13 +416,24 @@ foreach my $f (@flows) { } -% my $optimise= $specific; -% if (!$optimise) { +% my $optimise= 1; -

% if (!$specific) { +% $optimise= 0; Route contains archipelago(es), not just specific islands. +% } elsif (!@subflows) { +% $optimise= 0; +% if ($any_previous_suppression) { +All available trades deselected. +% } else { +No available trades meet the specified minimum trade value, so +all available trades deselected. +% } % } + +% if (!$optimise) { + +

Therefore, optimal voyage trade plan not calculated. % } else { # ========== OPTMISATION ========== -- 2.30.2