summaryrefslogtreecommitdiff
path: root/lib/Travelynx
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-05-29 21:49:31 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-05-29 21:49:31 +0200
commit85c7861bc135111c12b17b9d9961674d2f269f8d (patch)
treed4cd18fab721fd745cdfc46c1bb1e9935462abc0 /lib/Travelynx
parent1ad8fa3a51b930807d76d92a2d42bdd7f4ef5b80 (diff)
request wagon orders for HAFAS checkins
Diffstat (limited to 'lib/Travelynx')
-rw-r--r--lib/Travelynx/Command/work.pm16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/Travelynx/Command/work.pm b/lib/Travelynx/Command/work.pm
index eea6d1b..5787c47 100644
--- a/lib/Travelynx/Command/work.pm
+++ b/lib/Travelynx/Command/work.pm
@@ -60,7 +60,7 @@ sub run {
return;
}
- if ( $found_dep->{rt_dep} ) {
+ if ( $found_dep->rt_dep ) {
$self->app->in_transit->update_departure_hafas(
uid => $uid,
journey => $journey,
@@ -68,9 +68,15 @@ sub run {
dep_eva => $dep,
arr_eva => $arr
);
+ if ( $journey->class <= 16
+ and $found_dep->rt_dep->epoch > $now->epoch )
+ {
+ $self->app->add_wagonorder( $uid, 1, $train_id,
+ $found_dep->sched_dep, $journey->number );
+ }
}
- if ( $found_arr and $found_arr->{rt_arr} ) {
+ if ( $found_arr and $found_arr->rt_arr ) {
$self->app->in_transit->update_arrival_hafas(
uid => $uid,
journey => $journey,
@@ -78,6 +84,12 @@ sub run {
dep_eva => $dep,
arr_eva => $arr
);
+ if ( $journey->class <= 16
+ and $now->epoch - $found_dep->rt_arr->epoch > 600 )
+ {
+ $self->app->add_wagonorder( $uid, 0, $train_id,
+ $found_dep->sched_dep, $journey->number );
+ }
}
}
)->catch(