diff options
author | Birte Kristina Friesel <birte.friesel@uos.de> | 2025-01-31 06:53:29 +0100 |
---|---|---|
committer | Birte Kristina Friesel <birte.friesel@uos.de> | 2025-01-31 06:53:29 +0100 |
commit | 22d57710f75707fc1fe3f7e36923b72178f39aed (patch) | |
tree | 32d125d8102511a7b516b22eb8344aa0737a45c8 /lib/Travel/Routing/DE | |
parent | d896bdcddc4e6e0161a3cab449ef4b11963543ab (diff) |
Indicate Add tranfer_duration accessor; set is_unlikely if negative
Diffstat (limited to 'lib/Travel/Routing/DE')
-rw-r--r-- | lib/Travel/Routing/DE/DBRIS/Connection.pm | 18 | ||||
-rw-r--r-- | lib/Travel/Routing/DE/DBRIS/Connection/Segment.pm | 2 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/Travel/Routing/DE/DBRIS/Connection.pm b/lib/Travel/Routing/DE/DBRIS/Connection.pm index 6ff4507..40bce91 100644 --- a/lib/Travel/Routing/DE/DBRIS/Connection.pm +++ b/lib/Travel/Routing/DE/DBRIS/Connection.pm @@ -90,6 +90,24 @@ sub new { ); } + for my $i ( 0 .. $#{ $ref->{segments} // [] } - 1 ) { + if ( $ref->{segments}[$i]{train_short} ) { + my $arr = $ref->{segments}[$i]->arr; + for my $j ( $i + 1 .. $#{ $ref->{segments} // [] } ) { + if ( $ref->{segments}[$j]{train_short} ) { + my $dep = $ref->{segments}[$j]->dep; + if ( $arr and $dep ) { + $ref->{segments}[$j]{transfer_duration} = $dep - $arr; + if ( $dep < $arr ) { + $ref->{segments}[$i]{is_unlikely} = 1; + } + } + last; + } + } + } + } + for my $key (qw(sched_dep rt_dep dep)) { $ref->{$key} = $ref->{segments}[0]{$key}; } diff --git a/lib/Travel/Routing/DE/DBRIS/Connection/Segment.pm b/lib/Travel/Routing/DE/DBRIS/Connection/Segment.pm index 1b01d77..1f6e598 100644 --- a/lib/Travel/Routing/DE/DBRIS/Connection/Segment.pm +++ b/lib/Travel/Routing/DE/DBRIS/Connection/Segment.pm @@ -18,7 +18,7 @@ Travel::Routing::DE::DBRIS::Connection::Segment->mk_ro_accessors( sched_dep rt_dep dep dep_platform sched_arr rt_arr arr arr_platform sched_duration rt_duration duration duration_percent - arr_delay dep_delay delay feasibility is_unlikely + arr_delay dep_delay delay feasibility is_unlikely transfer_duration journey_id occupancy occupancy_first occupancy_second is_transfer is_walk walk_name distance_m |