Unverified Commit 46bacf67 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Allow users to specify the requested number of via stops

parent 986d3384
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ my $use_colour = 'auto';
my ( $json_output, $raw_json_output, $with_polyline );
my @output_args;
my %show_output;
my $num_route_entries = 3;

my %known_mot = map { $_ => 1 }
  (qw(ICE EC_IC IR REGIONAL SBAHN BUS SCHIFF UBAHN TRAM ANRUFPFLICHTIG));
@@ -54,6 +55,7 @@ GetOptions(
	'devmode'              => \$developer_mode,
	'json'                 => \$json_output,
	'raw-json'             => \$raw_json_output,
	'route-entries=i'      => \$num_route_entries,
	'with-polyline'        => \$with_polyline,

) or show_help(1);
@@ -97,9 +99,13 @@ for my $field ( split( qr{,}, join( q{,}, @output_args ) ) ) {
	}
}

# the "via"s reported by the backend typically include both the current stop
# and the terminus. So we requist $num_route_entries + 2 stops to ensure that
# we end up with at least $num_route_entries usable stops.
my %opt = (
	cache          => $cache,
	station        => $station,
	num_vias       => $num_route_entries + 2,
	developer_mode => $developer_mode,
);

+2 −1
Original line number Diff line number Diff line
@@ -68,7 +68,8 @@ sub new {
		  . $station->{eva}
		  . '&ortId='
		  . $station->{id}
		  . '&mitVias=true&maxVias=8';
		  . '&mitVias=true&maxVias='
		  . ( $conf{num_vias} // 5 );
		for my $mot (@mots) {
			$req .= '&verkehrsmittel[]=' . $mot;
		}