diff options
| author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-11-16 21:38:20 +0100 |
|---|---|---|
| committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-11-16 21:38:35 +0100 |
| commit | 13396e443590aa2611dc163a9593ebfb6afce503 (patch) | |
| tree | 8a0ce636fed1cbf06f09a56cd5497010cb0a89a0 /lib | |
| parent | 7bbb014105a9e90d3da12f85241be1712e8e2c85 (diff) | |
Add journey->trip_numbers and loc->trip_no accessors
Related to #9
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Travel/Status/DE/DBRIS/Journey.pm | 9 | ||||
| -rw-r--r-- | lib/Travel/Status/DE/DBRIS/Location.pm | 5 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/Travel/Status/DE/DBRIS/Journey.pm b/lib/Travel/Status/DE/DBRIS/Journey.pm index 79da609..e87a73e 100644 --- a/lib/Travel/Status/DE/DBRIS/Journey.pm +++ b/lib/Travel/Status/DE/DBRIS/Journey.pm @@ -76,7 +76,8 @@ sub new { my @trip_no_argmax = reverse sort { $trip_no_ml{$a} <=> $trip_no_ml{$b} } keys %trip_no_ml; - $ref->{train_no} = $trip_no_argmax[0]; + $ref->{train_no} = $trip_no_argmax[0]; + $ref->{trip_numbers} = \@trip_no_argmax; } } @@ -220,6 +221,12 @@ sub operators { return @{ $self->{operators} // [] }; } +sub trip_numbers { + my ($self) = @_; + + return @{ $self->{trip_numbers} // [] }; +} + sub TO_JSON { my ($self) = @_; diff --git a/lib/Travel/Status/DE/DBRIS/Location.pm b/lib/Travel/Status/DE/DBRIS/Location.pm index c4d9a63..f6f4f1c 100644 --- a/lib/Travel/Status/DE/DBRIS/Location.pm +++ b/lib/Travel/Status/DE/DBRIS/Location.pm @@ -10,7 +10,7 @@ our $VERSION = '0.17'; Travel::Status::DE::DBRIS::Location->mk_ro_accessors( qw(eva id lat lon name admin_id products type is_cancelled is_additional is_separation display_priority - dep arr sched_dep sched_arr rt_dep rt_arr arr_delay dep_delay delay + trip_no dep arr sched_dep sched_arr rt_dep rt_arr arr_delay dep_delay delay platform sched_platform rt_platform occupancy_first occupancy_second occupancy ) @@ -76,6 +76,9 @@ sub new { if ( $json->{adminID} ) { $ref->{admin_id} = $json->{adminID}; } + if ( $json->{nummer} ) { + $ref->{trip_no} = $json->{nummer}; + } for my $occupancy ( @{ $json->{auslastungsmeldungen} // [] } ) { if ( $occupancy->{klasse} eq 'KLASSE_1' ) { |
