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

perltidy

parent a9d742e6
Loading
Loading
Loading
Loading
+24 −14
Original line number Diff line number Diff line
@@ -601,14 +601,19 @@ sub startup {
							# Lines may serve the same stop several times.
							# Keep looking until the scheduled departure
							# matches the one passed while checking in.
							if ( $ts and $stopover->scheduled_departure->epoch == $ts ) {
							if (    $ts
								and $stopover->scheduled_departure->epoch
								== $ts )
							{
								last;
							}
						}
					}

					if ( not $found_stopover ) {
						$promise->reject("Did not find stopover at '$station' within trip '$train_id'");
						$promise->reject(
"Did not find stopover at '$station' within trip '$train_id'"
						);
						return;
					}

@@ -640,7 +645,8 @@ sub startup {
					};

					if ($@) {
						$self->app->log->error("Checkin($uid): INSERT failed: $@");
						$self->app->log->error(
							"Checkin($uid): INSERT failed: $@");
						$promise->reject( 'INSERT failed: ' . $@ );
						return;
					}
@@ -652,21 +658,25 @@ sub startup {
						for my $coordinate ( $trip->polyline ) {
							if ( $coordinate->{stop} ) {
								if ( not defined $coordinate->{stop}->{eva} ) {
									die()
									die();
								}

								push(
									@coordinate_list,
									[
										$coordinate->{lon}, $coordinate->{lat},
										$coordinate->{lon},
										$coordinate->{lat},
										$coordinate->{stop}->{eva}
									]
								);

								push( @station_list, $coordinate->{stop}->name );
								push( @station_list,
									$coordinate->{stop}->name );
							}
							else {
								push( @coordinate_list, [ $coordinate->{lon}, $coordinate->{lat} ] );
								push( @coordinate_list,
									[ $coordinate->{lon}, $coordinate->{lat} ]
								);
							}
						}

@@ -680,7 +690,8 @@ sub startup {
						}
						else {
							$polyline = {
								from_eva => ( $trip->stopovers )[0]->stop->{eva},
								from_eva =>
								  ( $trip->stopovers )[0]->stop->{eva},
								to_eva => ( $trip->stopovers )[-1]->stop->{eva},
								coords => \@coordinate_list,
							};
@@ -2572,7 +2583,6 @@ sub startup {
				if ( $seen{$key} ) {
					next;
				}

				$seen{$key} = 1;

				# direction does not matter at the moment
+2 −1
Original line number Diff line number Diff line
@@ -3270,7 +3270,8 @@ sub sync_backends_motis {
		}
	}

	$db->update( 'schema_version', { motis => $Travel::Status::MOTIS::VERSION } );
	$db->update( 'schema_version',
		{ motis => $Travel::Status::MOTIS::VERSION } );
}

sub setup_db {
+8 −4
Original line number Diff line number Diff line
@@ -197,7 +197,8 @@ sub run {

						for my $stopover ( $journey->stopovers ) {
							if ( not defined $stopover->stop->{eva} ) {
								my $stop = $self->app->stations->get_by_external_id(
								my $stop
								  = $self->app->stations->get_by_external_id(
									external_id => $stopover->stop->id,
									motis       => $entry->{backend_name},
								  );
@@ -220,7 +221,8 @@ sub run {
						}

						if ( not $found_departure ) {
							$self->app->log->debug("Did not find $dep within trip $train_id");
							$self->app->log->debug(
								"Did not find $dep within trip $train_id");
							return;
						}

@@ -235,7 +237,9 @@ sub run {
							);
						}

						if ( $found_arrival and $found_arrival->realtime_arrival ) {
						if (    $found_arrival
							and $found_arrival->realtime_arrival )
						{
							$self->app->in_transit->update_arrival_motis(
								uid      => $uid,
								journey  => $journey,
+6 −7
Original line number Diff line number Diff line
@@ -1169,8 +1169,7 @@ sub backend_form {
			elsif ( $s->{coverage}{area}
				and $s->{coverage}{area}{type} eq 'MultiPolygon' )
			{
				for my $s_poly (
					@{ $s->{coverage}{area}{coordinates} // [] } )
				for my $s_poly ( @{ $s->{coverage}{area}{coordinates} // [] } )
				{
					if (
						$self->lonlat_in_polygon(
+10 −8
Original line number Diff line number Diff line
@@ -1148,7 +1148,7 @@ sub station {
			timestamp  => $timestamp,
			lookbehind => 30,
			lookahead  => 30,
		)
		);
	}
	else {
		$promise = $self->iris->get_departures_p(
@@ -1206,11 +1206,13 @@ sub station {
			elsif ($motis_service) {
				@results = map { $_->[0] }
				  sort { $b->[1] <=> $a->[1] }
				  map { [ $_, $_->stopover->departure->epoch ] } $status->results;
				  map  { [ $_, $_->stopover->departure->epoch ] }
				  $status->results;

				$status = {
					station_eva  => $station,
					station_name     => $status->{results}->[0]->stopover->stop->name,
					station_name =>
					  $status->{results}->[0]->stopover->stop->name,
					related_stations => [],
				};
			}
Loading