diff options
| author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-06-22 13:00:24 +0200 | 
|---|---|---|
| committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-06-22 13:00:24 +0200 | 
| commit | 9e346af2010f96ddc95ac6114f06b8561340250d (patch) | |
| tree | 3e0071909769fc30f1c218e0793621222f2af85f | |
| parent | d332156b3a037ad7d60964fc68dbd2bd6b20d6af (diff) | |
add_intransit: allow users to specify timestamps for intermediate stops
| -rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 21 | ||||
| -rw-r--r-- | templates/add_intransit.html.ep | 4 | 
2 files changed, 18 insertions, 7 deletions
| diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index cf33175..2748da3 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -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,  						]  					);  				} diff --git a/templates/add_intransit.html.ep b/templates/add_intransit.html.ep index 77682a8..666b624 100644 --- a/templates/add_intransit.html.ep +++ b/templates/add_intransit.html.ep @@ -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"> | 
