summaryrefslogtreecommitdiff
path: root/lib/Travelynx
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2025-01-09 22:27:03 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2025-01-09 22:27:03 +0100
commitaf6d1a7b6abb6f9322faa11d3f03d3fb963239fd (patch)
tree1ef70730aa55eef2a14e358e219f18712a28b59b /lib/Travelynx
parent590985eb2435b1164cb50108ac254e00cd8b4709 (diff)
VRN and ÖBB EVA IDs are compatible with bahn.de → request wagon ordersHEAD2.9.15main
Diffstat (limited to 'lib/Travelynx')
-rw-r--r--lib/Travelynx/Command/work.pm39
1 files changed, 23 insertions, 16 deletions
diff --git a/lib/Travelynx/Command/work.pm b/lib/Travelynx/Command/work.pm
index 98f478a..4473483 100644
--- a/lib/Travelynx/Command/work.pm
+++ b/lib/Travelynx/Command/work.pm
@@ -6,6 +6,8 @@ package Travelynx::Command::work;
use Mojo::Base 'Mojolicious::Command';
use Mojo::Promise;
+use utf8;
+
use DateTime;
use JSON;
use List::Util;
@@ -83,22 +85,27 @@ sub run {
dep_eva => $dep,
arr_eva => $arr
);
- if ( $entry->{backend_id} <= 1
- and $journey->class <= 16
- and $found_dep->rt_dep->epoch > $now->epoch )
- {
- $self->app->add_wagonorder(
- uid => $uid,
- train_id => $journey->id,
- is_departure => 1,
- eva => $dep,
- datetime => $found_dep->sched_dep,
- train_type => $journey->type,
- train_no => $journey->number,
- );
- $self->app->add_stationinfo( $uid, 1,
- $journey->id, $found_dep->loc->eva );
- }
+ }
+ if (
+ $found_dep->sched_dep
+ and ( $entry->{backend_id} <= 1
+ or $entry->{backend_name} eq 'VRN'
+ or $entry->{backend_name} eq 'ÖBB' )
+ and $journey->class <= 16
+ and $found_dep->dep->epoch > $now->epoch
+ )
+ {
+ $self->app->add_wagonorder(
+ uid => $uid,
+ train_id => $journey->id,
+ is_departure => 1,
+ eva => $dep,
+ datetime => $found_dep->sched_dep,
+ train_type => $journey->type =~ s{ +$}{}r,
+ train_no => $journey->number,
+ );
+ $self->app->add_stationinfo( $uid, 1,
+ $journey->id, $found_dep->loc->eva );
}
if ( $found_arr and $found_arr->rt_arr ) {