diff options
author | Daniel Friesel <derf@finalrewind.org> | 2014-10-26 10:50:59 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2014-10-26 10:50:59 +0100 |
commit | db2e06e1decb3b25df765b75326a8e35248d1def (patch) | |
tree | 79ef77c97753d199604adb00cf014f15dc8da56e /lib/Travel | |
parent | 34793a5b499f42991fdd5acd7f81074d3e03fb68 (diff) |
add support for canceled / additional stops. untested at the moment
Diffstat (limited to 'lib/Travel')
-rw-r--r-- | lib/Travel/Status/DE/IRIS/Result.pm | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/IRIS/Result.pm b/lib/Travel/Status/DE/IRIS/Result.pm index 85abee7..69ed01a 100644 --- a/lib/Travel/Status/DE/IRIS/Result.pm +++ b/lib/Travel/Status/DE/IRIS/Result.pm @@ -11,6 +11,7 @@ use parent 'Class::Accessor'; use Carp qw(cluck); use DateTime; use DateTime::Format::Strptime; +use List::Compare; use List::MoreUtils qw(none uniq firstval); our $VERSION = '0.05'; @@ -189,6 +190,24 @@ sub add_tl { return $self; } +sub additional_stops { + my ($self) = @_; + + $self->{comparator} + //= List::Compare->new( $self->{sched_route_post}, $self->{route_post} ); + + return $self->{comparator}->get_complement; +} + +sub canceled_stops { + my ($self) = @_; + + $self->{comparator} + //= List::Compare->new( $self->{sched_route_post}, $self->{route_post} ); + + return $self->{comparator}->get_unique; +} + sub merge_with_departure { my ( $self, $result ) = @_; @@ -475,7 +494,7 @@ sub translate_msg { 64 => 'Weichenstörung', 55 => 'Technische Störung an einem anderen Zug', # ? 57 => 'Zusätzlicher Halt', # ? - 58 => 'Umleitung(?)', # ? + 58 => 'Umleitung(?)', # ? 63 => 'Technische Untersuchung am Zug', 80 => 'Abweichende Wagenreihung', 82 => 'Mehrere Wagen fehlen', |