X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=blobdiff_plain;f=yarrg%2Fweb%2Fquery_routesearch;h=1828f374bc5b97e90546bc417d0b7bd5940d61f6;hp=357ba94ed39395e86d230801cef31fa53a9ef26d;hb=f62749dec2d8b67a9b4b4a910e1159907654d426;hpb=d5b83c4ad6c572a578d1a3be1af21c7bf8e679cd diff --git a/yarrg/web/query_routesearch b/yarrg/web/query_routesearch index 357ba94..1828f37 100644 --- a/yarrg/web/query_routesearch +++ b/yarrg/web/query_routesearch @@ -42,6 +42,7 @@ $islandstring => ''; $capacitystring => ''; $lossperleague => ''; $capitalstring => ''; +$minprofitstring => ''; $distance => ''; $prselector $someresults @@ -56,6 +57,8 @@ my $emsg; my @warningfs; my @islandids; +my $destspec; + my $maxmaxdist=35; my $maxcpu=90; my $concur_lim=5; @@ -83,21 +86,44 @@ This feature is not available from the "drop down menus" interface. islandids_r => \@islandids, archipelagoes_r => undef &> +% my $searchtype= $ARGS{RouteSearchType}; +% if ($searchtype == 0) { +% $destspec= 'any'; +% } elsif ($searchtype == 1) { +% $destspec= 'circ'; +% } elsif ($searchtype == 2) { + +Destination (one island only): +<& qtextstring, qa => $qa, dbh => $dbh, emsgstore => \$emsg, + thingstring => 'deststring', + prefix => 'ds', boxopts => 'size=40', + onresults => sub { +print STDERR "ONRESULTS @_\n"; + return unless @_; + my ($canonname, $island, $arch) = @{ $_[0] }; + die unless defined $island; + $destspec= $island; + } + &> + +% } else { +% die "$destspec ?"; +% } + <&| enter_advrouteopts, qa=>$qa, dbh=>$dbh, routeparams=>$routeparams &>     Maximum distance: - <&| qtextstring, qa => $qa, dbh => $dbh, prefix => 'ml', - thingstring => 'distance', emsgstore => \$emsg, - onresults => sub { ($maxdist)= @_; } &> - size=10 - + <& qtextstring, qa => $qa, dbh => $dbh, prefix => 'ml', + thingstring => 'distance', emsgstore => \$emsg, boxopts => 'size=10', + onresults => sub { ($maxdist)= @_; } + &> -% my $ours= sub { $_[0] =~ m/^lossperleague|^islandstring|^capitalstring|^capacitystring|^distance/; }; +% my $ours= sub { $_[0] =~ m/^lossperleague|^islandstring|^deststring|^capitalstring|^capacitystring|^minprofitstring|^distance/; }; <& "lookup:formhidden", ours => $ours &> % } @@ -116,6 +142,7 @@ print(""), return unless $emsgokorprint->($emsg) and @islandids and $allargs->{'submit'} + and defined $destspec and (defined $routeparams->{MaxMass} or defined $routeparams->{MaxVolume}); @@ -147,9 +174,9 @@ foreach my $k (qw(MaxMass MaxVolume MaxCapital)) { } push @rsargs, defined $routeparams->{LossPerLeaguePct} ? $routeparams->{LossPerLeaguePct}*0.01 : 1e-9; -push @rsargs, '0'; +push @rsargs, 0; #$routeparams->{MinProfit}; push @rsargs, 'search',$maxdist, $maxcountea,$maxcountea; -push @rsargs, $ARGS{RouteSearchType} ? 'circ' : 'any'; +push @rsargs, $destspec; push @rsargs, @islandids; m/[^-.0-9a-zA-Z]/ and die "$_ $& ?" foreach @rsargs;