mirror of
https://github.com/derf/travelynx
synced 2024-12-11 21:42:38 +00:00
request wagon orders for HAFAS checkins
This commit is contained in:
parent
1ad8fa3a51
commit
85c7861bc1
2 changed files with 19 additions and 3 deletions
|
@ -633,6 +633,10 @@ sub startup {
|
||||||
# mustn't be called during a transaction
|
# mustn't be called during a transaction
|
||||||
if ( not $opt{in_transaction} ) {
|
if ( not $opt{in_transaction} ) {
|
||||||
$self->run_hook( $uid, 'checkin' );
|
$self->run_hook( $uid, 'checkin' );
|
||||||
|
if ( $journey->class <= 16 ) {
|
||||||
|
$self->app->add_wagonorder( $uid, 1, $journey->id,
|
||||||
|
$found->sched_dep, $journey->number );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$promise->resolve($journey);
|
$promise->resolve($journey);
|
||||||
|
@ -1232,7 +1236,7 @@ sub startup {
|
||||||
|
|
||||||
my $db = $self->pg->db;
|
my $db = $self->pg->db;
|
||||||
|
|
||||||
if ($sched_departure) {
|
if ( $sched_departure and $train_no ) {
|
||||||
$self->dbdb->has_wagonorder_p( $sched_departure, $train_no )
|
$self->dbdb->has_wagonorder_p( $sched_departure, $train_no )
|
||||||
->then(
|
->then(
|
||||||
sub {
|
sub {
|
||||||
|
|
|
@ -60,7 +60,7 @@ sub run {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $found_dep->{rt_dep} ) {
|
if ( $found_dep->rt_dep ) {
|
||||||
$self->app->in_transit->update_departure_hafas(
|
$self->app->in_transit->update_departure_hafas(
|
||||||
uid => $uid,
|
uid => $uid,
|
||||||
journey => $journey,
|
journey => $journey,
|
||||||
|
@ -68,9 +68,15 @@ sub run {
|
||||||
dep_eva => $dep,
|
dep_eva => $dep,
|
||||||
arr_eva => $arr
|
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(
|
$self->app->in_transit->update_arrival_hafas(
|
||||||
uid => $uid,
|
uid => $uid,
|
||||||
journey => $journey,
|
journey => $journey,
|
||||||
|
@ -78,6 +84,12 @@ sub run {
|
||||||
dep_eva => $dep,
|
dep_eva => $dep,
|
||||||
arr_eva => $arr
|
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(
|
)->catch(
|
||||||
|
|
Loading…
Reference in a new issue