Unverified Commit 9e346af2 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

add_intransit: allow users to specify timestamps for intermediate stops

parent d332156b
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -2711,18 +2711,27 @@ sub add_intransit_form {
		if ( $trip{route} ) {
			my @unknown_stations;
			for my $station ( @{ $trip{route} } ) {
				my $ts;
				my %station_data;
				if ( $station
					=~ m{ ^ (?<stop> [^@]+? ) \s* [@] \s* (?<timestamp> .+ ) $ }x
				  )
				{
					$station = $+{stop};
					$ts      = $parser->parse_datetime( $+{timestamp} );
					$station_data{sched_arr} = $ts->epoch;
					$station_data{sched_dep} = $ts->epoch;
				}
				my $station_info = $self->stations->search( $station,
					backend_id => $opt{backend_id} );
				$station_data{lat} = $station_info->{lat};
				$station_data{lon} = $station_info->{lon};
				if ($station_info) {
					push(
						@route,
						[
							$station_info->{name},
							$station_info->{eva},
							{
								lat => $station_info->{lat},
								lon => $station_info->{lon},
							}
							$station_info->{name}, $station_info->{eva},
							\%station_data,
						]
					);
				}
+3 −1
Original line number Diff line number Diff line
@@ -63,7 +63,9 @@
	<div class="row">
		<div class="input-field col s12">
			%= text_area 'route', id => 'route', class => 'materialize-textarea'
			<label for="route">Halte (optional, eine Station pro Zeile, wahlweise Unterwegshalte oder komplette Route)</label>
			<label for="route">Halte (optional)</label><br/>
			Eine Station pro Zeile, wahlweise Unterwegshalte oder komplette Route<br/>
			Format: <i>Name</i> oder <i>Name</i> @ <i>Zeitpunkt</i> (inkl. Datum, siehe oben)
		</div>
	</div>
	<div class="row">