diff options
author | Daniel Friesel <derf@finalrewind.org> | 2022-10-02 19:39:29 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2022-10-02 19:39:29 +0200 |
commit | f3beaf2d9eb789a6f745d4606d2e95bbb5ad29ae (patch) | |
tree | ee4f11d4aad30a8b9d7c91cdf1d81eff4cf7feb9 /lib/Travel/Status/DE/HAFAS | |
parent | eb72c48659b909599c7e798c37cded83805275b4 (diff) |
DB: Switch to mgate.exe API
Diffstat (limited to 'lib/Travel/Status/DE/HAFAS')
-rw-r--r-- | lib/Travel/Status/DE/HAFAS/Result.pm | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/lib/Travel/Status/DE/HAFAS/Result.pm b/lib/Travel/Status/DE/HAFAS/Result.pm index 71f9d1e..1fc13ce 100644 --- a/lib/Travel/Status/DE/HAFAS/Result.pm +++ b/lib/Travel/Status/DE/HAFAS/Result.pm @@ -11,8 +11,8 @@ use parent 'Class::Accessor'; our $VERSION = '3.01'; Travel::Status::DE::HAFAS::Result->mk_ro_accessors( - qw(sched_date date sched_datetime datetime info operator raw_e_delay - raw_delay sched_time time train route_end) + qw(sched_date date sched_datetime datetime info is_cancelled operator delay + sched_time time train route_end) ); sub new { @@ -21,17 +21,16 @@ sub new { my $ref = \%conf; bless( $ref, $obj ); - if ( my $delay = $ref->delay ) { - $ref->{datetime} - = $ref->{sched_datetime}->clone->add( minutes => $delay ); - $ref->{date} = $ref->{datetime}->strftime('%d.%m.%Y'); - $ref->{time} = $ref->{datetime}->strftime('%H:%M'); + if ( $ref->{delay} ) { + $ref->{datetime} = $ref->{rt_datetime}; } else { $ref->{datetime} = $ref->{sched_datetime}; - $ref->{date} = $ref->{sched_date}; - $ref->{time} = $ref->{sched_time}; } + $ref->{date} = $ref->{datetime}->strftime('%d.%m.%Y'); + $ref->{time} = $ref->{datetime}->strftime('%H:%M'); + $ref->{sched_date} = $ref->{sched_datetime}->strftime('%d.%m.%Y'); + $ref->{sched_time} = $ref->{sched_datetime}->strftime('%H:%M'); return $ref; } @@ -56,21 +55,6 @@ sub countdown_sec { return $self->{countdown_sec}; } -sub delay { - my ($self) = @_; - - if ( defined $self->{raw_e_delay} ) { - return $self->{raw_e_delay}; - } - if ( defined $self->{raw_delay} - and $self->{raw_delay} ne q{-} - and $self->{raw_delay} ne 'cancel' ) - { - return $self->{raw_delay}; - } - return; -} - sub destination { my ($self) = @_; @@ -83,15 +67,6 @@ sub line { return $self->{train}; } -sub is_cancelled { - my ($self) = @_; - - if ( $self->{raw_delay} and $self->{raw_delay} eq 'cancel' ) { - return 1; - } - return 0; -} - sub is_changed_platform { my ($self) = @_; |