diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Travel/Status/DE/DBWagenreihung.pm | 7 | ||||
-rw-r--r-- | lib/Travel/Status/DE/DBWagenreihung/Group.pm | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/Travel/Status/DE/DBWagenreihung.pm b/lib/Travel/Status/DE/DBWagenreihung.pm index 9dce04e..b120b14 100644 --- a/lib/Travel/Status/DE/DBWagenreihung.pm +++ b/lib/Travel/Status/DE/DBWagenreihung.pm @@ -158,6 +158,7 @@ sub parse_wagonorder { $self->parse_carriages; $self->{destinations} = $self->merge_group_attr('destination'); $self->{train_numbers} = $self->merge_group_attr('train_no'); + $self->{trains} = $self->merge_group_attr('train'); } sub merge_group_attr { @@ -272,6 +273,12 @@ sub train_numbers { return @{ $self->{train_numbers} // [] }; } +sub trains { + my ($self) = @_; + + return @{ $self->{trains} // [] }; +} + sub sectors { my ($self) = @_; diff --git a/lib/Travel/Status/DE/DBWagenreihung/Group.pm b/lib/Travel/Status/DE/DBWagenreihung/Group.pm index b6848ab..3da0670 100644 --- a/lib/Travel/Status/DE/DBWagenreihung/Group.pm +++ b/lib/Travel/Status/DE/DBWagenreihung/Group.pm @@ -89,6 +89,8 @@ sub new { train_no => $json{transport}{number}, }; + $ref->{train} = $ref->{train_type} . ' ' . $ref->{train_no}; + $ref->{sectors} = [ uniq grep { defined } map { $_->{platformPosition}{sector} } @{ $json{vehicles} // [] } |