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

expose route and arrival times

parent e872f700
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -495,6 +495,38 @@ sub parse_mgate {
			}
		}

		my @stops;
		for my $stop ( @{ $result->{stopL} // [] } ) {
			my $loc = $locL[ $stop->{locX} ];
			my $arr = $stop->{aTimeS};
			my $arr_dt;
			if ($arr) {
				if ( length($arr) == 8 ) {

					# arrival time includes a day offset
					my $offset_date = $self->{now}->clone;
					$offset_date->add( days => substr( $arr, 0, 2, q{} ) );
					$offset_date = $offset_date->strftime('%Y%m%d');
					$arr_dt      = $self->{strptime_obj}
					  ->parse_datetime("${offset_date}T${arr}");
				}
				else {
					$arr_dt
					  = $self->{strptime_obj}->parse_datetime("${date}T${arr}");
				}
			}
			push(
				@stops,
				{
					name    => $loc->{name},
					eva     => $loc->{extId} + 0,
					arrival => $arr_dt,
				}
			);
		}

		shift @stops;

		push(
			@{ $self->{results} },
			Travel::Status::DE::HAFAS::Result->new(
@@ -510,6 +542,7 @@ sub parse_mgate {
				platform       => $platform,
				new_platform   => $new_platform,
				messages       => \@messages,
				route          => \@stops,
			)
		);
	}
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ our $VERSION = '3.01';

Travel::Status::DE::HAFAS::Result->mk_ro_accessors(
	qw(sched_date date sched_datetime datetime info is_cancelled operator delay
	  sched_time time train route_end)
	  sched_time time train route route_end)
);

sub new {