worker: select on arr and dep eva for all arr/dep updates
still missing (TODO): add_route_timestamps
This commit is contained in:
parent
609d7b3ebc
commit
f79e34fb62
2 changed files with 13 additions and 4 deletions
|
@ -64,9 +64,11 @@ sub run {
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->app->in_transit->update_departure(
|
$self->app->in_transit->update_departure(
|
||||||
uid => $uid,
|
uid => $uid,
|
||||||
train => $train,
|
train => $train,
|
||||||
route => [ $self->app->iris->route_diff($train) ]
|
dep_eva => $dep,
|
||||||
|
arr_eva => $arr,
|
||||||
|
route => [ $self->app->iris->route_diff($train) ]
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( $train->departure_is_cancelled and $arr ) {
|
if ( $train->departure_is_cancelled and $arr ) {
|
||||||
|
@ -143,6 +145,7 @@ sub run {
|
||||||
uid => $uid,
|
uid => $uid,
|
||||||
train => $train,
|
train => $train,
|
||||||
route => [ $self->app->iris->route_diff($train) ],
|
route => [ $self->app->iris->route_diff($train) ],
|
||||||
|
dep_eva => $dep,
|
||||||
arr_eva => $arr,
|
arr_eva => $arr,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -333,6 +333,8 @@ sub update_departure {
|
||||||
my ( $self, %opt ) = @_;
|
my ( $self, %opt ) = @_;
|
||||||
my $uid = $opt{uid};
|
my $uid = $opt{uid};
|
||||||
my $db = $opt{db} // $self->{pg}->db;
|
my $db = $opt{db} // $self->{pg}->db;
|
||||||
|
my $dep_eva = $opt{dep_eva};
|
||||||
|
my $arr_eva = $opt{arr_eva};
|
||||||
my $train = $opt{train};
|
my $train = $opt{train};
|
||||||
my $route = $opt{route};
|
my $route = $opt{route};
|
||||||
my $json = JSON->new;
|
my $json = JSON->new;
|
||||||
|
@ -358,7 +360,9 @@ sub update_departure {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
user_id => $uid,
|
user_id => $uid,
|
||||||
train_no => $train->train_no
|
train_no => $train->train_no,
|
||||||
|
checkin_station_id => $dep_eva,
|
||||||
|
checkout_station_id => $arr_eva,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -395,6 +399,7 @@ sub update_arrival {
|
||||||
my ( $self, %opt ) = @_;
|
my ( $self, %opt ) = @_;
|
||||||
my $uid = $opt{uid};
|
my $uid = $opt{uid};
|
||||||
my $db = $opt{db} // $self->{pg}->db;
|
my $db = $opt{db} // $self->{pg}->db;
|
||||||
|
my $dep_eva = $opt{dep_eva};
|
||||||
my $arr_eva = $opt{arr_eva};
|
my $arr_eva = $opt{arr_eva};
|
||||||
my $train = $opt{train};
|
my $train = $opt{train};
|
||||||
my $route = $opt{route};
|
my $route = $opt{route};
|
||||||
|
@ -424,6 +429,7 @@ sub update_arrival {
|
||||||
{
|
{
|
||||||
user_id => $uid,
|
user_id => $uid,
|
||||||
train_no => $train->train_no,
|
train_no => $train->train_no,
|
||||||
|
checkin_station_id => $dep_eva,
|
||||||
checkout_station_id => $arr_eva,
|
checkout_station_id => $arr_eva,
|
||||||
}
|
}
|
||||||
)->rows;
|
)->rows;
|
||||||
|
|
Loading…
Reference in a new issue