chiark / gitweb /
Print sensible error if all trades deselected.
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 22 Nov 2009 14:18:29 +0000 (14:18 +0000)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 22 Nov 2009 14:18:29 +0000 (14:18 +0000)
yarrg/web/routetrade

index 1b7c8c945bb312b0c7073eb5de1e8361910cd148..21f4711cebfe0498d72f70ec7a2e66b7b25c49b0 100644 (file)
@@ -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) {
 }
 </%perl>
 
-% my $optimise= $specific;
-% if (!$optimise) {
+% my $optimise= 1;
 
-<p>
 % 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) {
+
+<p>
 Therefore, optimal voyage trade plan not calculated.
 
 % } else { # ========== OPTMISATION ==========