summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-10-28 20:25:18 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2024-10-28 20:25:18 +0100
commit9b6b310e2eb10d713f53f413ca5b9f03815b6ebb (patch)
tree7002991ca30c1bec7fced1260efd75bad65e8c8f
parent481c49a3c279fa0cc684f0c0c724b248b9ac149c (diff)
Use the correct stop instance when checking in to ring lines
-rwxr-xr-xlib/Travelynx.pm10
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm6
2 files changed, 13 insertions, 3 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index f9199a5..e154e8d 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -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;
@@ -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;
@@ -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 ) {
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index 3151d42..bbd85b6 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -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(
@@ -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(