<%args>
$quri
$dbh
+$queryqf
$islandstring => '';
$capacitystring => '';
$lossperleague => '';
$capitalstring => '';
$distance => '';
-$someresults
$emsgokorprint
</%args>
my $row= $islandname_stmt->fetchrow_hashref();
local $_= $row->{'islandname'};
s/ Island$//;
- return $_, $row->{'archipelago'};
+ return $_, $row->{'islandname'}, $row->{'archipelago'};
};
#---------- compute the results ----------
}
unshift @rsargs,
- sourcebasedir().'/yarrg/routesearch',
+ 'nice', sourcebasedir().'/yarrg/routesearch',
'-d', dbw_filename($qa->{'Ocean'}),
'-C', webdatadir().'/_concur.', '.lock';
my ($ap,$isles) = (uc $1,$5);
next if $results{$ap} && %{$results{$ap}} >= $maxcountea;
my $item= { A => $3, P => $4, Leagues => $2 };
- my (@i, @a);
+ my (@i, @fi, @a);
foreach (split / /, $isles) {
- my ($name,$arch)= $isleinfo->($_);
+ my ($name,$fullname,$arch)= $isleinfo->($_);
push @i, $name;
+ push @fi, $fullname;
push @a, $arch unless @a && $a[-1] eq $arch;
}
$item->{Isles}= [ @i ];
for ($i=1; $i < @i-1; $i++) {
push @{ $item->{Vias} }, $i[$i];
}
+ my %linkqf= %$queryqf;
+ delete $linkqf{'query'};
+ $linkqf{'routestring'}= join ', ', @fi;
+ $item->{Url}= $quri->(%linkqf);
$results{$ap}{$isles}= $item;
}
print "</pre>\n";
}
+$!=0;
+if (!close $fh) {
+ die $! if $!;
+ die $? if $? != 24; # SIGXCPU but not in POSIX.pm :-/
+</%perl>
+<h2>Search took too long and was terminated</h2>
+
+Sorry, but your query resulted in a search that took too long.
+Searches are limited to <% $maxcpu |h %> seconds of CPU time to
+avoid them consuming excessive resources on the server system, and to
+make sure that shorter searches can still happen.
+
+<p>
+Please try a search with a smaller minimum distance, or place more
+restrictions on the route.
+
+<%perl>
+ return;
+}
+
if ($concur_fail) {
</%perl>
<h2>Server too busy</h2>
</%perl>
% foreach my $ap (qw(A P)) {
-<h2>ap=<% $ap %></h2>
+% if ($ap eq 'A') {
+<h2>Best routes for total profit</h2>
+% } else {
+<h2>Best routes for profit per league</h2>
+% }
<table rules=groups>
<colgroup span=2>
<colgroup span=1>
<td align=right><% $item->{A} |h %>
<td align=right><% $item->{P} |h %>
<td align=right><% $item->{Leagues} |h %>
-<td align=left><% join ', ', @{ $item->{Archs} } |h %>
+<td align=left><a href="<% $item->{Url} |h %>"><% join ', ', @{ $item->{Archs} } |h %></a>
<td align=left><% $item->{Start} |h %>,
<td align=left><% join ' ', map { $_.',' } @{ $item->{Vias} } |h %>
<td align=left><% $item->{Finish} |h %>
% } # $isles
</table>
% } # $ap
+
+<p>
+
+<h2>Notes</h2>
+
+Per league values count each island visited as one
+(additional) league; the `Dist.' column is however the actual distance
+to be sailed. All profit figures are somewhat approximate; get a
+complete trading plan for a route for accurate information.
+
<%perl>