chiark / gitweb /
Normalise commodity name case (from uploads)
[ypp-sc-tools.web-live.git] / yarrg / web / query_routesearch
index 87e9d33649bbbb0846f2efc08325f7c0d46d33c1..126c4e804d860a807d5abfb57b5dd36dd66a728c 100644 (file)
@@ -51,6 +51,8 @@ $allargs
 </%args>
 
 <%perl>
+no warnings qw(exec);
+
 use BSD::Resource;
 
 my $emsg;
@@ -181,7 +183,7 @@ foreach my $k (qw(MaxMass MaxVolume MaxCapital)) {
 }
 push @rsargs, defined $routeparams->{LossPerLeaguePct}
        ? $routeparams->{LossPerLeaguePct}*0.01 : 1e-9;
-push @rsargs, $routeparams->{MinProfit};
+push @rsargs, $routeparams->{MinProfit} // 0;
 push @rsargs, 'search',$maxdist, $maxcountea,$maxcountea;
 push @rsargs, $destspec;
 push @rsargs, @islandids;
@@ -228,7 +230,7 @@ while (<$fh>) {
        }
        die unless m/^ \@ *\d+ ([ap])\# *\d+ \|.*\| *(\d+)lg *\| *\d+ +(\d+) +(\d+) *\| ([0-9 ]+)$/;
        my ($ap,$isles) = (uc $1,$5);
-       next if $results{$ap} && %{$results{$ap}} >= $maxcountea;
+       next if $results{$ap} && keys %{$results{$ap}} >= $maxcountea;
        my $item= { A => $3, P => $4, Leagues => $2 };
        my (@i, @fi, @a);
        foreach (split / /, $isles) {