summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-01-05 22:25:35 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-01-05 22:25:35 +0100
commit228476067c3bb9d0e5c029ae745dd615881eaec5 (patch)
treedad851ffdefa711efb21b383d9b43e6e7909bec8 /lib
parentba6a8d18d3ff347fa46e6e06f73937419e961e2d (diff)
destinations: Show sections for each destination
Diffstat (limited to 'lib')
-rw-r--r--lib/Travel/Status/DE/DBWagenreihung.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/DBWagenreihung.pm b/lib/Travel/Status/DE/DBWagenreihung.pm
index 7bba010..1f3c440 100644
--- a/lib/Travel/Status/DE/DBWagenreihung.pm
+++ b/lib/Travel/Status/DE/DBWagenreihung.pm
@@ -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;