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

hafas: strip common city suffix

parent c0a7d8a0
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -1588,6 +1588,10 @@ sub handle_result {
				);
			}
			else {
				my $city = q{};
				if ( $result->station =~ m{ , ([^,]+) $ }x ) {
					$city = $1;
				}
				push(
					@departures,
					{
@@ -1603,9 +1607,11 @@ sub handle_result {
						train_line => $result->line,
						train_no   => $result->number,
						journey_id => $result->id,
						via        =>
						  [ map { $_->{name} } $result->route_interesting(3) ],
						destination        => $result->destination,
						via        => [
							map { $_->{name} =~ s{,$city}{}r }
							  $result->route_interesting(3)
						],
						destination => $result->destination =~ s{,$city}{}r,
						origin      => $result->origin,
						platform    => $result->platform,
						scheduled_platform => $result->sched_platform,