Skip to content

Commit

Permalink
Use the correct stop instance when checking in to ring lines
Browse files Browse the repository at this point in the history
  • Loading branch information
derf committed Oct 28, 2024
1 parent 481c49a commit 9b6b310
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 9 additions & 1 deletion lib/Travelynx.pm
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ sub startup {

my $station = $opt{station};
my $train_id = $opt{train_id};
my $ts = $opt{ts};
my $uid = $opt{uid} // $self->current_user->{id};
my $db = $opt{db} // $self->pg->db;
my $hafas;
Expand Down Expand Up @@ -534,6 +535,7 @@ sub startup {

my $station = $opt{station};
my $train_id = $opt{train_id};
my $ts = $opt{ts};
my $uid = $opt{uid} // $self->current_user->{id};
my $db = $opt{db} // $self->pg->db;
my $hafas;
Expand All @@ -553,7 +555,13 @@ sub startup {
or $stop->loc->eva == $station )
{
$found = $stop;
last;

# Lines may serve the same stop several times.
# Keep looking until the scheduled departure
# matches the one passed while checking in.
if ( $ts and $stop->sched_dep->epoch == $ts ) {
last;
}
}
}
if ( not $found ) {
Expand Down
6 changes: 4 additions & 2 deletions lib/Travelynx/Controller/Traveling.pm
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,8 @@ sub travel_action {
return $self->checkin_p(
hafas => $params->{hafas},
station => $params->{station},
train_id => $params->{train}
train_id => $params->{train},
ts => $params->{ts},
);
}
)->then(
Expand Down Expand Up @@ -789,7 +790,8 @@ sub travel_action {
$self->checkin_p(
hafas => $params->{hafas},
station => $params->{station},
train_id => $params->{train}
train_id => $params->{train},
ts => $params->{ts},
)->then(
sub {
$self->render(
Expand Down

0 comments on commit 9b6b310

Please sign in to comment.