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

Switch to Travel::Status::DE::HAFAS 5.x

parent c24edf30
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ requires 'Mojo::Pg';
requires 'Text::CSV';
requires 'Text::Markdown';
requires 'Travel::Status::DE::DBWagenreihung';
requires 'Travel::Status::DE::HAFAS', '== 4.19';
requires 'Travel::Status::DE::HAFAS', '>= 5.03';
requires 'Travel::Status::DE::IRIS';
requires 'UUID::Tiny';
requires 'JSON';
+2 −1
Original line number Diff line number Diff line
@@ -541,7 +541,8 @@ sub startup {
					my ($journey) = @_;
					my $found;
					for my $stop ( $journey->route ) {
						if ( $stop->name eq $station or $stop->eva == $station )
						if (   $stop->loc->name eq $station
							or $stop->loc->eva == $station )
						{
							$found = $stop;
							last;
+2 −2
Original line number Diff line number Diff line
@@ -46,10 +46,10 @@ sub run {
					my $found_dep;
					my $found_arr;
					for my $stop ( $journey->route ) {
						if ( $stop->eva == $dep ) {
						if ( $stop->loc->eva == $dep ) {
							$found_dep = $stop;
						}
						if ( $arr and $stop->eva == $arr ) {
						if ( $arr and $stop->loc->eva == $arr ) {
							$found_arr = $stop;
							last;
						}
+15 −15
Original line number Diff line number Diff line
@@ -171,20 +171,20 @@ sub get_route_timestamps_p {

			my $station_is_past = 1;
			for my $stop ( $journey->route ) {
				my $name = $stop->{name};
				$ret->{$name} = $ret->{ $stop->{eva} } = {
					name      => $stop->{name},
					eva       => $stop->{eva},
					sched_arr => _epoch( $stop->{sched_arr} ),
					sched_dep => _epoch( $stop->{sched_dep} ),
					rt_arr    => _epoch( $stop->{rt_arr} ),
					rt_dep    => _epoch( $stop->{rt_dep} ),
					arr_delay => $stop->{arr_delay},
					dep_delay => $stop->{dep_delay},
					load      => $stop->{load}
				my $name = $stop->loc->name;
				$ret->{$name} = $ret->{ $stop->loc->eva } = {
					name      => $stop->loc->name,
					eva       => $stop->loc->eva,
					sched_arr => _epoch( $stop->sched_arr ),
					sched_dep => _epoch( $stop->sched_dep ),
					rt_arr    => _epoch( $stop->rt_arr ),
					rt_dep    => _epoch( $stop->rt_dep ),
					arr_delay => $stop->arr_delay,
					dep_delay => $stop->dep_delay,
					load      => $stop->load
				};
				if (    ( $stop->{arr_cancelled} or not $stop->{sched_arr} )
					and ( $stop->{dep_cancelled} or not $stop->{sched_dep} ) )
				if (    ( $stop->arr_cancelled or not $stop->sched_arr )
					and ( $stop->dep_cancelled or not $stop->sched_dep ) )
				{
					$ret->{$name}{isCancelled} = 1;
				}
@@ -229,8 +229,8 @@ sub get_route_timestamps_p {
					or index( $hafas_stations, $iris_stations ) != -1 )
				{
					$polyline = {
						from_eva => ( $journey->route )[0]{eva},
						to_eva   => ( $journey->route )[-1]{eva},
						from_eva => ( $journey->route )[0]->loc->eva,
						to_eva   => ( $journey->route )[-1]->loc->eva,
						coords   => \@coordinate_list,
					};
				}
+19 −19
Original line number Diff line number Diff line
@@ -126,16 +126,16 @@ sub add {
			push(
				@route,
				[
					$j_stop->name,
					$j_stop->eva,
					$j_stop->loc->name,
					$j_stop->loc->eva,
					{
						sched_arr => _epoch( $j_stop->{sched_arr} ),
						sched_dep => _epoch( $j_stop->{sched_dep} ),
						rt_arr    => _epoch( $j_stop->{rt_arr} ),
						rt_dep    => _epoch( $j_stop->{rt_dep} ),
						arr_delay => $j_stop->{arr_delay},
						dep_delay => $j_stop->{dep_delay},
						load      => $j_stop->{load}
						sched_arr => _epoch( $j_stop->sched_arr ),
						sched_dep => _epoch( $j_stop->sched_dep ),
						rt_arr    => _epoch( $j_stop->rt_arr ),
						rt_dep    => _epoch( $j_stop->rt_dep ),
						arr_delay => $j_stop->arr_delay,
						dep_delay => $j_stop->dep_delay,
						load      => $j_stop->load
					}
				]
			);
@@ -147,7 +147,7 @@ sub add {
				cancelled => $stop->{dep_cancelled}
				? 1
				: 0,
				checkin_station_id => $stop->eva,
				checkin_station_id => $stop->loc->eva,
				checkin_time => DateTime->now( time_zone => 'Europe/Berlin' ),
				dep_platform => $stop->{platform},
				train_type   => $journey->type // q{},
@@ -724,16 +724,16 @@ sub update_arrival_hafas {
		push(
			@route,
			[
				$j_stop->name,
				$j_stop->eva,
				$j_stop->loc->name,
				$j_stop->loc->eva,
				{
					sched_arr => _epoch( $j_stop->{sched_arr} ),
					sched_dep => _epoch( $j_stop->{sched_dep} ),
					rt_arr    => _epoch( $j_stop->{rt_arr} ),
					rt_dep    => _epoch( $j_stop->{rt_dep} ),
					arr_delay => $j_stop->{arr_delay},
					dep_delay => $j_stop->{dep_delay},
					load      => $j_stop->{load}
					sched_arr => _epoch( $j_stop->sched_arr ),
					sched_dep => _epoch( $j_stop->sched_dep ),
					rt_arr    => _epoch( $j_stop->rt_arr ),
					rt_dep    => _epoch( $j_stop->rt_dep ),
					arr_delay => $j_stop->arr_delay,
					dep_delay => $j_stop->dep_delay,
					load      => $j_stop->load
				}
			]
		);
Loading