mirror of
https://github.com/derf/travelynx
synced 2024-11-10 06:54:17 +00:00
perform stationinfo requests for hafas checkins
This commit is contained in:
parent
85c7861bc1
commit
2576a463db
2 changed files with 27 additions and 3 deletions
|
@ -508,6 +508,8 @@ sub startup {
|
|||
$self->add_route_timestamps( $uid, $train, 1 );
|
||||
$self->add_wagonorder( $uid, 1, $train->train_id,
|
||||
$train->sched_departure, $train->train_no );
|
||||
$self->add_stationinfo( $uid, 1, $train->train_id,
|
||||
$eva );
|
||||
$self->run_hook( $uid, 'checkin' );
|
||||
}
|
||||
|
||||
|
@ -636,6 +638,8 @@ sub startup {
|
|||
if ( $journey->class <= 16 ) {
|
||||
$self->app->add_wagonorder( $uid, 1, $journey->id,
|
||||
$found->sched_dep, $journey->number );
|
||||
$self->add_stationinfo( $uid, 1, $journey->id,
|
||||
$found->loc->eva );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1000,6 +1004,8 @@ sub startup {
|
|||
$self->add_route_timestamps( $uid, $train, 0, 1 );
|
||||
$self->add_wagonorder( $uid, 0, $train->train_id,
|
||||
$train->sched_departure, $train->train_no );
|
||||
$self->add_stationinfo( $uid, 0, $train->train_id,
|
||||
$dep_eva, $new_checkout_station_id );
|
||||
}
|
||||
$promise->resolve( 1, undef );
|
||||
return;
|
||||
|
@ -1477,9 +1483,19 @@ sub startup {
|
|||
return;
|
||||
}
|
||||
)->wait;
|
||||
}
|
||||
);
|
||||
|
||||
$self->helper(
|
||||
'add_stationinfo' => sub {
|
||||
my ( $self, $uid, $is_departure, $train_id, $dep_eva, $arr_eva )
|
||||
= @_;
|
||||
|
||||
$uid //= $self->current_user->{id};
|
||||
|
||||
my $db = $self->pg->db;
|
||||
if ($is_departure) {
|
||||
$self->dbdb->get_stationinfo_p( $in_transit->{dep_eva} )->then(
|
||||
$self->dbdb->get_stationinfo_p($dep_eva)->then(
|
||||
sub {
|
||||
my ($station_info) = @_;
|
||||
my $data = { stationinfo_dep => $station_info };
|
||||
|
@ -1500,8 +1516,8 @@ sub startup {
|
|||
)->wait;
|
||||
}
|
||||
|
||||
if ( $in_transit->{arr_eva} and not $is_departure ) {
|
||||
$self->dbdb->get_stationinfo_p( $in_transit->{arr_eva} )->then(
|
||||
if ( $arr_eva and not $is_departure ) {
|
||||
$self->dbdb->get_stationinfo_p($arr_eva)->then(
|
||||
sub {
|
||||
my ($station_info) = @_;
|
||||
my $data = { stationinfo_arr => $station_info };
|
||||
|
|
|
@ -73,6 +73,8 @@ sub run {
|
|||
{
|
||||
$self->app->add_wagonorder( $uid, 1, $train_id,
|
||||
$found_dep->sched_dep, $journey->number );
|
||||
$self->app->add_stationinfo( $uid, 1, $journey->id,
|
||||
$found_dep->loc->eva );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,6 +91,8 @@ sub run {
|
|||
{
|
||||
$self->app->add_wagonorder( $uid, 0, $train_id,
|
||||
$found_dep->sched_dep, $journey->number );
|
||||
$self->app->add_stationinfo( $uid, 0, $journey->id,
|
||||
$found_dep->loc->eva, $found_arr->loc->eva );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -185,6 +189,8 @@ sub run {
|
|||
$self->app->add_route_timestamps( $uid, $train, 1 );
|
||||
$self->app->add_wagonorder( $uid, 1, $train->train_id,
|
||||
$train->sched_departure, $train->train_no );
|
||||
$self->app->add_stationinfo( $uid, 1, $train->train_id,
|
||||
$dep, $arr );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -259,6 +265,8 @@ sub run {
|
|||
);
|
||||
$self->app->add_wagonorder( $uid, 0, $train->train_id,
|
||||
$train->sched_departure, $train->train_no );
|
||||
$self->app->add_stationinfo( $uid, 0, $train->train_id,
|
||||
$dep, $arr );
|
||||
}
|
||||
}
|
||||
elsif ( $entry->{real_arr_ts} ) {
|
||||
|
|
Loading…
Reference in a new issue