chiark / gitweb /
Notice if $expected_total_profit parsing failed; don't break if it is an integer
[ypp-sc-tools.main.git] / yarrg / web / routetrade
index b27850676adb2a498288c853cae53cfbf29c1dc7..c7dd03e5d0166e63c4054ed3561450e8824ffff1 100644 (file)
@@ -261,6 +261,15 @@ foreach my $v (qw(MaxMass MaxVolume)) {
 <& dumptable:end, qa => $qa &>
 % }
 
+% if (@islandids==1) {
+%      if (defined $islandids[0]) {
+Searched for arbitrage trades only.
+%      } else {
+Searched for arbitrage trades only, in <% $archipelagoes[0] |h %>
+<a href="docs#arbitrage">[?]</a>.
+%      }
+% }
+
 <%perl>
 
 my @sail_total;
@@ -524,7 +533,7 @@ if ($qa->{'debug'}) {
                        $found_section= 1;
                        next;
                }
-               if (m/^Objective:\s+totalprofit = (\d+\.\d*) /) {
+               if (m/^Objective:\s+totalprofit = (\d+(?:\.\d*)?) /) {
                        $expected_total_profit= $1;
                }
                next unless $found_section==1;
@@ -565,6 +574,7 @@ if ($qa->{'debug'}) {
        my $prerr= "\n=====\n$cplex\n=====\n$glpsol_out\n=====\n ";
        pipethrough_run_finish($output,$prerr);
        map { defined $_->{OptQty} or die "$prerr $_->{Flow}{Ix}" } @subflows;
+       defined $expected_total_profit or die "$prerr ?";
 };
 
 $addcols->({ DoReverse => 1, TotalSubflows => 1, Special => sub {
@@ -603,6 +613,13 @@ $addcols->({ Total => 0, DoReverse => 1, TotalSubflows => 1 }, qw(
  <li><a href="#dataage">Data age summary</a>
  <li><a href="#trades">Relevant trades</a>
 </ul>
+% } else {
+%      my @tl= gmtime $now or die $!;
+<p>
+Generated by YARRG at <strong><%
+       sprintf "%04d-%02d-%02d %02d:%02d:%02d UTC",
+               $tl[5]+1900, @tl[4,3,2,1,0]
+                       |h %></strong>.
 % }
 
 % if ($optimise) { # ========== TRADING PLAN ==========
@@ -840,14 +857,6 @@ END
 <&| query_age:agestable, now => $now, fetchrow => $fetchrow &>
 Islands shown in reverse order of visits.<br>
 </&>
-% } else {
-%      my @tl= gmtime $now or die $!;
-<p>
-Generated by YARRG at <strong><%
-       sprintf "%04d-%02d-%02d %02d:%02d:%02d UTC",
-               $tl[5]+1900, @tl[4,3,2,1,0]
-                       |h %></strong>.
-%#     
 % }
 
 % if (!printable($m)) {