chiark / gitweb /
routesearch: support circular routes
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 17 Oct 2009 19:27:08 +0000 (20:27 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 17 Oct 2009 19:27:08 +0000 (20:27 +0100)
yarrg/TODO
yarrg/web/lookup
yarrg/web/query_routesearch

index f625803a5761c39115385046900d0cccca13c706..b202aad35c4cbc7b8a334035efd5df372001c0b6 100644 (file)
@@ -1,9 +1,3 @@
-query_routesearch:
-
-       circular routes
-       routes ending in specific place(s)
-
-
 UPLOADER
 --------
 
@@ -37,3 +31,4 @@ initial/final stocks feature
 printable voyage trading plan
 
 query_routesearch should show capital for each voyage
+query_routesearch should support ending in specific place(s)
index 15f341adc3cf8131fc41ae91b8ebd16abc450af2..2f67760c487d6f1281b37bcb819ca6a7b2dd3d01 100755 (executable)
@@ -80,6 +80,12 @@ my %styles;
                                [ 1, 'Show individual stalls' ],
                        ],
                QuerySpecific => 1,
+       }, {    Name => 'RouteSearchType',
+               Before => 'Type of routes to search for: ',
+               Values => [     [ 0, 'Open-ended' ],
+                               [ 1, 'Circular' ],
+                       ],
+               QuerySpecific => 1,
        });
 
 foreach my $var (@vars) {
@@ -248,7 +254,7 @@ $debug => 0
 <hr>
 
 <& "query_$styles{Query}", %baseqf, %queryqf, %styles,
-    quri => $quri, dbh => $dbh, queryqf => \%queryqf,
+    quri => $quri, dbh => $dbh, queryqf => \%queryqf, allargs => \%ARGS,
     prselector => $prselector,
     someresults => $someresults,
     emsgokorprint => sub {
index fadc20ed8db5d0b5b12e6942ba09742c9fa3854b..65f57f881531797d36bd7df6f1b39c3db331fce2 100644 (file)
@@ -42,8 +42,10 @@ $capacitystring => '';
 $lossperleague => '';
 $capitalstring => '';
 $distance => '';
+$prselector
 $someresults
 $emsgokorprint
+$allargs
 </%args>
 
 <%perl>
@@ -70,6 +72,8 @@ my $maxcountea=15;
 This feature is not available from the "drop down menus" interface.
 % } else {
 
+% $prselector->('RouteSearchType');
+
 <form action="<% $quri->() |h %>" method="get">
 
 <& enter_route, qa=>$qa, dbh=>$dbh, emsg_r=>\$emsg, warningfs_r=>\@warningfs,
@@ -106,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 ----------
@@ -137,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;