X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.main.git;a=blobdiff_plain;f=yarrg%2Fweb%2Fquery_routesearch;h=65f57f881531797d36bd7df6f1b39c3db331fce2;hp=36e6055b898610a3ccb2910e641203f9923bbddd;hb=a1fb96b672d234f5961a397215c19c2c631c5cc3;hpb=fbe374c3592808f9b3f105ec0726b26ada6c0ea0 diff --git a/yarrg/web/query_routesearch b/yarrg/web/query_routesearch index 36e6055..65f57f8 100644 --- a/yarrg/web/query_routesearch +++ b/yarrg/web/query_routesearch @@ -42,7 +42,10 @@ $capacitystring => ''; $lossperleague => ''; $capitalstring => ''; $distance => ''; +$prselector +$someresults $emsgokorprint +$allargs <%perl> @@ -69,6 +72,8 @@ my $maxcountea=15; This feature is not available from the "drop down menus" interface. % } else { +% $prselector->('RouteSearchType'); +
<& enter_route, qa=>$qa, dbh=>$dbh, emsg_r=>\$emsg, warningfs_r=>\@warningfs, @@ -89,7 +94,7 @@ This feature is not available from the "drop down menus" interface. - + % my $ours= sub { $_[0] =~ m/^lossperleague|^islandstring|^capitalstring|^capacitystring|^distance/; }; <& "lookup:formhidden", ours => $ours &> @@ -105,6 +110,7 @@ if (!$emsg && $maxdist > $maxmaxdist) { $emsgokorprint->($emsg) or return; @islandids or return; +$allargs->{'submit'} or return; defined $routeparams->{MaxMass} or defined $routeparams->{MaxVolume} or return; #---------- prepare island names ---------- @@ -136,7 +142,9 @@ foreach my $k (qw(MaxMass MaxVolume MaxCapital)) { push @rsargs, defined $routeparams->{LossPerLeaguePct} ? $routeparams->{LossPerLeaguePct}*0.01 : 1e-9; push @rsargs, '0'; -push @rsargs, 'search',$maxdist, $maxcountea,$maxcountea, 'any', @islandids; +push @rsargs, 'search',$maxdist, $maxcountea,$maxcountea; +push @rsargs, $ARGS{RouteSearchType} ? 'circ' : 'any'; +push @rsargs, @islandids; m/[^-.0-9a-zA-Z]/ and die "$_ $& ?" foreach @rsargs; @@ -202,6 +210,9 @@ while (<$fh>) { delete $linkqf{'query'}; $linkqf{'routestring'}= join ', ', @fi; $item->{Url}= $quri->(%linkqf); + $item->{ArchesString}= join ', ', @a; + $item->{ViasString}= join ' ', map { $_.',' } @{ $item->{Vias} }; + $item->{RouteSortString}= join ', ', @i; $results{$ap}{$isles}= $item; } @@ -252,6 +263,8 @@ seconds of CPU time so more processing resources should be available soon. return; } +$someresults->(); + % foreach my $ap (qw(A P)) { % if ($ap eq 'A') { @@ -259,44 +272,67 @@ seconds of CPU time so more processing resources should be available soon. % } else {

Best routes for profit per league

% } - +
- + + +% my $ci=0; +% my $rowid= "r${ap}$isles"; $rowid =~ y/ /_/; +% foreach my $k (qw(A P Leagues ArchesString +% Start RouteSortString Finish)) { +% $sortkeys{$ci}{$rowid}= $item->{$k}; +% $ci++; +% } + % $datarow ^= 1; % } # $isles
Profit Dist. Archipelagoes -Route + +Route +
Abs. Per.lg. - +(link to plan) Start Via Finish -
% my $datarow=0; +% my %sortkeys; % foreach my $isles (sort { % $results{$ap}{$b}{$ap} <=> % $results{$ap}{$a}{$ap} % } keys %{$results{$ap}}) { % my $item= $results{$ap}{$isles}; -
<% $item->{A} |h %> <% $item->{P} |h %> <% $item->{Leagues} |h %> -<% join ', ', @{ $item->{Archs} } |h %> +<% + $item->{ArchesString} |h %> <% $item->{Start} |h %>, -<% join ' ', map { $_.',' } @{ $item->{Vias} } |h %> +<% $item->{ViasString} |h %> <% $item->{Finish} |h %>
+<&| tabsort, table => "ap${ap}_table", sortkeys => "ap${ap}_sortkeys", + throw => "ap${ap}_sortrow", rowclass => "datarow", cols => [ + { DoReverse => 1, Numeric => 1 }, + { DoReverse => 1, Numeric => 1 }, + { DoReverse => 1, Numeric => 1 }, + { }, + { }, + { }, + { }, + ] &> + ap<% $ap %>_sortkeys= <% to_json_protecttags(\%sortkeys) %>; + % } # $ap