Commit 22847606 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

destinations: Show sections for each destination

parent ba6a8d18
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -74,7 +74,12 @@ printf(
	"%s: %s → %s  (%s)\n%s Gleis %s\n\n",
	join( ' / ', map { $wr->train_type . ' ' . $_ } $wr->train_numbers ),
	join( ' / ', $wr->origins ),
	join( ' / ', $wr->destinations ),
	join(
		' / ',
		map {
			sprintf( '%s (%s)', $_->{name}, join( q{}, @{ $_->{sections} } ) )
		} $wr->destinations
	),
	$wr->train_subtype // 'IC?',
	$wr->station_name,
	$wr->platform
+9 −1
Original line number Diff line number Diff line
@@ -121,13 +121,21 @@ sub destinations {
	}

	my @destinations;
	my %section;

	for my $group ( @{ $self->{data}{istformation}{allFahrzeuggruppe} } ) {
		push( @destinations, $group->{zielbetriebsstellename} );
		my $destination = $group->{zielbetriebsstellename};
		my @sections = map { $_->{fahrzeugsektor} } @{ $group->{allFahrzeug} };
		@sections = uniq @sections;
		push( @{ $section{$destination} }, @sections );
		push( @destinations,               $destination );
	}

	@destinations = uniq @destinations;

	@destinations
	  = map { { name => $_, sections => $section{$_} } } @destinations;

	$self->{destinations} = \@destinations;

	return @destinations;