diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-12-26 12:25:35 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-12-26 12:25:35 +0100 |
commit | c06d8c9b70e1950b8e7bd6ab7e14bac96d55ffc7 (patch) | |
tree | 9e4186b8782a56112c08973adbe459d8d8197e60 /lib/Travel/Status | |
parent | 0e4de4ce426b478914ac562462dd9d8aff803b5b (diff) |
show train direction
Diffstat (limited to 'lib/Travel/Status')
-rw-r--r-- | lib/Travel/Status/DE/DBWagenreihung.pm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Travel/Status/DE/DBWagenreihung.pm b/lib/Travel/Status/DE/DBWagenreihung.pm index c879d14..5308961 100644 --- a/lib/Travel/Status/DE/DBWagenreihung.pm +++ b/lib/Travel/Status/DE/DBWagenreihung.pm @@ -86,6 +86,23 @@ sub error { return $self->{errstr}; } +sub direction { + my ($self) = @_; + + my @wagons = $self->wagons; + + if ( not @wagons ) { + return undef; + } + + if ( $wagons[0]->{position}{start_percent} + > $wagons[-1]{position}{start_percent} ) + { + return 0; + } + return 100; +} + sub sections { my ($self) = @_; |