diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-12-14 22:49:45 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-12-14 22:49:45 +0100 |
commit | a50cdf13d48e2ba9f040cbd1000accdc3b751cdf (patch) | |
tree | 32895154b151a5b6dc4b19792814958727eb598f /lib/Travel/Status/DE/DBRIS/Journey.pm | |
parent | 87637c4f37a798718e75b5b9d7fb08a6fc606349 (diff) |
Journey: Add delay accessor
Diffstat (limited to 'lib/Travel/Status/DE/DBRIS/Journey.pm')
-rw-r--r-- | lib/Travel/Status/DE/DBRIS/Journey.pm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/DBRIS/Journey.pm b/lib/Travel/Status/DE/DBRIS/Journey.pm index df7eada..30026ca 100644 --- a/lib/Travel/Status/DE/DBRIS/Journey.pm +++ b/lib/Travel/Status/DE/DBRIS/Journey.pm @@ -9,7 +9,7 @@ use parent 'Class::Accessor'; our $VERSION = '0.01'; Travel::Status::DE::DBRIS::Journey->mk_ro_accessors( - qw(type dep sched_dep rt_dep is_cancelled line stop_name stop_eva id admin_id journey_id sched_platform platform dest_name dest_eva route) + qw(type dep sched_dep rt_dep delay is_cancelled line stop_name stop_eva id admin_id journey_id sched_platform platform dest_name dest_eva route) ); sub new { @@ -40,6 +40,11 @@ sub new { } $ref->{dep} = $ref->{rt_dep} // $ref->{schd_dep}; + if ( $ref->{sched_dep} and $ref->{rt_dep} ) { + $ref->{delay} = $ref->{rt_dep}->subtract_datetime( $ref->{sched_dep} ) + ->in_units('minutes'); + } + return $ref; } |