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

EFA: Use trip IDs with time data introduced in v3.12

parent cc47175e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ requires 'JSON::XS';
requires 'List::UtilsBy';
requires 'Mojolicious';
requires 'Travel::Status::DE::DBRIS',            '>= 0.06';
requires 'Travel::Status::DE::EFA',              '>= 3.09';
requires 'Travel::Status::DE::EFA',              '>= 3.13';
requires 'Travel::Status::DE::HAFAS',            '>= 5.06';
requires 'Travel::Status::DE::IRIS';
requires 'Travel::Status::MOTIS';
+20 −10
Original line number Diff line number Diff line
@@ -324,12 +324,15 @@ sub route_efa {
	my $backend = $self->param('efa');

	my $stopseq;
	if ( $trip_id =~ m{ ^ ([^@]*) @ ([^@]*) [(] ([^)]*) [)] (.*)  $ }x ) {
	if ( $trip_id
		=~ m{ ^ ([^@]*) @ ([^@]*) [(] ([^T]*) T ([^)]*) [)] (.*)  $ }x )
	{
		$stopseq = {
			stateless => $1,
			stop_id   => $2,
			date      => $3,
			key       => $4
			time      => $4,
			key       => $5
		};
	}
	else {
@@ -708,16 +711,20 @@ sub route_motis {
					push( @stop_lines, 'Gleis ' . $stop->track );
				}
				if ( $stopover->arrival ) {
					my $arr_line = $stopover->arrival->strftime('Ankunft: %H:%M');
					my $arr_line
					  = $stopover->arrival->strftime('Ankunft: %H:%M');
					if ( $stopover->arrival_delay ) {
						$arr_line .= sprintf( ' (%+d)', $stopover->arrival_delay );
						$arr_line
						  .= sprintf( ' (%+d)', $stopover->arrival_delay );
					}
					push( @stop_lines, $arr_line );
				}
				if ( $stopover->departure ) {
					my $dep_line = $stopover->departure->strftime('Abfahrt: %H:%M');
					my $dep_line
					  = $stopover->departure->strftime('Abfahrt: %H:%M');
					if ( $stopover->departure_delay ) {
						$dep_line .= sprintf( ' (%+d)', $stopover->departure_delay );
						$dep_line
						  .= sprintf( ' (%+d)', $stopover->departure_delay );
					}
					push( @stop_lines, $dep_line );
				}
@@ -997,12 +1004,15 @@ sub ajax_route_efa {
	my $trip_id = $self->stash('tripid');

	my $stopseq;
	if ( $trip_id =~ m{ ^ ([^@]*) @ ([^@]*) [(] ([^)]*) [)] (.*)  $ }x ) {
	if ( $trip_id
		=~ m{ ^ ([^@]*) @ ([^@]*) [(] ([^T]*) T ([^)]*) [)] (.*)  $ }x )
	{
		$stopseq = {
			stateless => $1,
			stop_id   => $2,
			date      => $3,
			key       => $4
			time      => $4,
			key       => $5
		};
	}
	else {
+10 −13
Original line number Diff line number Diff line
@@ -1517,12 +1517,15 @@ sub train_details_efa {
	my $trip_id = $self->stash('train');

	my $stopseq;
	if ( $trip_id =~ m{ ^ ([^@]*) @ ([^@]*) [(] ([^)]*) [)] (.*)  $ }x ) {
	if ( $trip_id
		=~ m{ ^ ([^@]*) @ ([^@]*) [(] ([^T]*) T ([^)]*) [)] (.*)  $ }x )
	{
		$stopseq = {
			stateless => $1,
			stop_id   => $2,
			date      => $3,
			key       => $4
			time      => $4,
			key       => $5
		};
	}
	else {
@@ -2169,13 +2172,7 @@ sub render_board_efa {
				train_type   => q{},
				train_line   => $result->line,
				train_no     => $result->train_no,
				journey_id => sprintf( '%s@%d(%s)%d',
					$result->stateless =~ s{ }{}gr,
					scalar $result->route_pre
					? ( $result->route_pre )[0]->id_num
					: $result->stop_id_num,
					$result->sched_datetime->strftime('%Y%m%d'),
					$result->key ),
				journey_id   => $result->id,
				via          => [ map { $_->name } $result->route_interesting ],
				origin       => $result->origin,
				destination  => $result->destination,