summaryrefslogtreecommitdiff
path: root/lib/Travel/Routing/DE/DBRIS/Connection.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel/Routing/DE/DBRIS/Connection.pm')
-rw-r--r--lib/Travel/Routing/DE/DBRIS/Connection.pm18
1 files changed, 18 insertions, 0 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};
}